Fix creation of LVM VGs when LVM PV is encrypted.

This commit is contained in:
Andrius Štikonas 2016-10-30 03:24:01 +00:00
parent 0827eda687
commit 724574e436
3 changed files with 15 additions and 8 deletions

View File

@ -198,8 +198,12 @@ qint64 LvmDevice::mappedSector(const QString& lvPath, qint64 sector) const
const QStringList LvmDevice::deviceNodes() const
{
QStringList pvList;
for (const auto &p : physicalVolumes())
pvList << p->partitionPath();
for (const auto &p : physicalVolumes()) {
if (p->roles().has(PartitionRole::Luks))
pvList << static_cast<const FS::luks*>(&p->fileSystem())->mapperName();
else
pvList << p->partitionPath();
}
return pvList;
}
@ -414,8 +418,12 @@ bool LvmDevice::createVG(Report& report, const QString vgName, const QList<const
QStringList args = QStringList();
args << QStringLiteral("vgcreate") << QStringLiteral("--physicalextentsize") << QString::number(peSize);
args << vgName;
for (const auto &p : pvList)
args << p->partitionPath();
for (const auto &p : pvList) {
if (p->roles().has(PartitionRole::Luks))
args << static_cast<const FS::luks*>(&p->fileSystem())->mapperName();
else
args << p->partitionPath();
}
ExternalCommand cmd(report, QStringLiteral("lvm"), args);

View File

@ -41,9 +41,9 @@ bool ResizeVolumeGroupJob::run(Report& parent)
for (const auto &p : partList()) {
if (type() == ResizeVolumeGroupJob::Grow)
rval = LvmDevice::insertPV(*report, device(), p->partitionPath());
rval = LvmDevice::insertPV(*report, device(), p->partitionPath()); // FIXME: LUKS
else if (type() == ResizeVolumeGroupJob::Shrink)
rval = LvmDevice::removePV(*report, device(), p->partitionPath());
rval = LvmDevice::removePV(*report, device(), p->partitionPath()); // FIXME: LUKS
if (rval == false)
break;

View File

@ -126,8 +126,7 @@ bool DeleteOperation::canDelete(const Partition* p)
if (p->roles().has(PartitionRole::Luks))
{
const FileSystem& fsRef = p->fileSystem();
const FS::luks* luksFs = dynamic_cast<const FS::luks*>(&fsRef);
const FS::luks* luksFs = dynamic_cast<const FS::luks*>(&p->fileSystem());
if (!luksFs)
return false;