[partition] Including new LVM PVs in LVM VG creation GUI.

This commit is contained in:
Caio 2018-06-08 18:52:53 -03:00
parent e5351cdf3c
commit f8897e0e0b
2 changed files with 26 additions and 2 deletions

View File

@ -25,7 +25,6 @@
// KPMcore
#include <kpmcore/core/device.h>
#include <kpmcore/core/lvmdevice.h>
// KF5
#include <KFormat>
@ -80,7 +79,7 @@ DeviceModel::data( const QModelIndex& index, int role ) const
return device->deviceNode();
else
{
if ( device->capacity() != 1 )
if ( device->logicalSize() >= 0 && device->totalLogical() >= 0 )
return tr( "%1 - %2 (%3)" )
.arg( device->name() )
.arg( KFormat().formatByteSize( device->capacity() ) )

View File

@ -50,6 +50,7 @@
#include <kpmcore/backend/corebackend.h>
#include <kpmcore/backend/corebackendmanager.h>
#include <kpmcore/fs/filesystemfactory.h>
#include <kpmcore/fs/luks.h>
#include <kpmcore/fs/lvm2_pv.h>
// Qt
@ -604,6 +605,30 @@ PartitionCoreModule::scanForLVMPVs()
for ( auto p : LVM::pvList )
m_lvmPVs << p.partition().data();
for ( DeviceInfo* d : m_deviceInfos )
{
for ( auto job : d->jobs )
{
// Including new LVM PVs
CreatePartitionJob* partJob = dynamic_cast<CreatePartitionJob*>( job.data() );
if ( partJob )
{
Partition* p = partJob->partition();
if ( p->fileSystem().type() == FileSystem::Type::Lvm2_PV )
m_lvmPVs << p;
else if ( p->fileSystem().type() == FileSystem::Type::Luks || p->fileSystem().type() == FileSystem::Type::Luks2 )
{
// Encrypted LVM PVs
FileSystem* innerFS = static_cast<const FS::luks*>(&p->fileSystem())->innerFS();
if ( innerFS && innerFS->type() == FileSystem::Type::Lvm2_PV )
m_lvmPVs << p;
}
}
}
}
}
PartitionCoreModule::DeviceInfo*