Merge pull request #1119 from cjlcarvalho/master
[partition] Fixing LVM scanning according to new kpmcore API
This commit is contained in:
commit
9917bc27fc
1
AUTHORS
1
AUTHORS
@ -11,6 +11,7 @@ Andrius Štikonas
|
|||||||
Bernhard Landauer
|
Bernhard Landauer
|
||||||
Bezzy1999
|
Bezzy1999
|
||||||
bill-auger
|
bill-auger
|
||||||
|
Caio Jordão Carvalho
|
||||||
crispg72
|
crispg72
|
||||||
demmm
|
demmm
|
||||||
Gabriel Craciunescu
|
Gabriel Craciunescu
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
#include <kpmcore/core/device.h>
|
#include <kpmcore/core/device.h>
|
||||||
#include <kpmcore/core/lvmdevice.h>
|
#include <kpmcore/core/lvmdevice.h>
|
||||||
#include <kpmcore/core/partition.h>
|
#include <kpmcore/core/partition.h>
|
||||||
|
#include <kpmcore/core/volumemanagerdevice.h>
|
||||||
#include <kpmcore/backend/corebackend.h>
|
#include <kpmcore/backend/corebackend.h>
|
||||||
#include <kpmcore/backend/corebackendmanager.h>
|
#include <kpmcore/backend/corebackendmanager.h>
|
||||||
#include <kpmcore/fs/filesystemfactory.h>
|
#include <kpmcore/fs/filesystemfactory.h>
|
||||||
@ -550,26 +551,22 @@ PartitionCoreModule::lvmPVs() const
|
|||||||
bool
|
bool
|
||||||
PartitionCoreModule::hasVGwithThisName( const QString& name ) const
|
PartitionCoreModule::hasVGwithThisName( const QString& name ) const
|
||||||
{
|
{
|
||||||
for ( DeviceInfo* d : m_deviceInfos )
|
auto condition = [ name ]( DeviceInfo* d ) {
|
||||||
if ( dynamic_cast<LvmDevice*>(d->device.data()) &&
|
return dynamic_cast<LvmDevice*>(d->device.data()) && d->device.data()->name() == name;
|
||||||
d->device.data()->name() == name)
|
};
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
return std::find_if( m_deviceInfos.begin(), m_deviceInfos.end(), condition ) != m_deviceInfos.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PartitionCoreModule::isInVG( const Partition *partition ) const
|
PartitionCoreModule::isInVG( const Partition *partition ) const
|
||||||
{
|
{
|
||||||
for ( DeviceInfo* d : m_deviceInfos )
|
auto condition = [ partition ]( DeviceInfo* d ) {
|
||||||
{
|
|
||||||
LvmDevice* vg = dynamic_cast<LvmDevice*>( d->device.data());
|
LvmDevice* vg = dynamic_cast<LvmDevice*>( d->device.data());
|
||||||
|
return vg && vg->physicalVolumes().contains( partition );
|
||||||
|
};
|
||||||
|
|
||||||
if ( vg && vg->physicalVolumes().contains( partition ))
|
return std::find_if( m_deviceInfos.begin(), m_deviceInfos.end(), condition ) != m_deviceInfos.end();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -686,12 +683,13 @@ PartitionCoreModule::scanForLVMPVs()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update LVM::pvList
|
|
||||||
LvmDevice::scanSystemLVM( physicalDevices );
|
|
||||||
|
|
||||||
#ifdef WITH_KPMCOREGT33
|
#ifdef WITH_KPMCOREGT33
|
||||||
|
VolumeManagerDevice::scanDevices( physicalDevices );
|
||||||
|
|
||||||
for ( auto p : LVM::pvList::list() )
|
for ( auto p : LVM::pvList::list() )
|
||||||
#else
|
#else
|
||||||
|
LvmDevice::scanSystemLVM( physicalDevices );
|
||||||
|
|
||||||
for ( auto p : LVM::pvList )
|
for ( auto p : LVM::pvList )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user