Fix handling of encrypted LVM physical volumes.

This commit is contained in:
Andrius Štikonas 2016-11-03 14:21:18 +00:00
parent e47dd74635
commit bb8514e859
3 changed files with 16 additions and 0 deletions

View File

@ -18,6 +18,7 @@
*************************************************************************/
#include "fs/luks.h"
#include "fs/lvm2_pv.h"
#include "fs/filesystemfactory.h"
@ -274,6 +275,10 @@ bool luks::cryptOpen(QWidget* parent, const QString& deviceNode)
if (!m_isCryptOpen)
return false;
for (auto &p : LVM::pvList) // FIXME: qAsConst
if (p.isLuks() && p.partition()->deviceNode() == deviceNode && p.partition()->fileSystem().type() == FileSystem::Lvm2_PV)
p.setLuks(false);
m_passphrase = passphrase;
return true;
}
@ -309,6 +314,10 @@ bool luks::cryptClose(const QString& deviceNode)
m_isCryptOpen = (m_innerFs != nullptr);
for (auto &p : LVM::pvList) // FIXME: qAsConst
if (!p.isLuks() && p.partition()->deviceNode() == deviceNode)
p.setLuks(true);
return true;
}

View File

@ -268,6 +268,9 @@ QList<LvmPV> lvm2_pv::getPVinNode(const PartitionNode* parent)
// FIXME: reenable newly created PVs (before applying) once everything works
if(p->fileSystem().type() == FileSystem::Lvm2_PV && p->deviceNode() == p->partitionPath())
partitions.append(LvmPV(p->mountPoint(), p));
if(p->fileSystem().type() == FileSystem::Luks && p->deviceNode() == p->partitionPath())
partitions.append(LvmPV(p->mountPoint(), p, true));
}
return partitions;

View File

@ -51,6 +51,10 @@ public:
return m_isLuks;
}
void setLuks(bool luks) {
m_isLuks = luks;
}
private:
QString m_vgName;
QPointer<const Partition> m_p;