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

View File

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

View File

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