A small dirty hack to keep track of all the PVs that to be added to any VG.
This commit is contained in:
parent
6915187fb2
commit
25bbce4975
|
@ -56,6 +56,8 @@ LvmDevice::LvmDevice(const QString& name, const QString& iconname)
|
|||
initPartitions();
|
||||
}
|
||||
|
||||
QStringList LvmDevice::s_DirtyPVs;
|
||||
|
||||
LvmDevice::~LvmDevice()
|
||||
{
|
||||
delete m_PVPathList;
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
Partition* scanPartition(const QString& lvPath, PartitionTable* pTable) const;
|
||||
QStringList deviceNodeList() const override;
|
||||
QStringList lvPathList() const;
|
||||
static QStringList s_DirtyPVs;
|
||||
|
||||
public:
|
||||
static QList<LvmDevice*> scanSystemLVM();
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
*/
|
||||
CreateVolumeGroupOperation::CreateVolumeGroupOperation(const QString& vgname, const QStringList& pvlist, const qint32 pesize) :
|
||||
Operation(),
|
||||
m_CreateVolumeGroupJob(new CreateVolumeGroupJob(vgname, pvlist, pesize))
|
||||
m_CreateVolumeGroupJob(new CreateVolumeGroupJob(vgname, pvlist, pesize)),
|
||||
m_PVList(pvlist)
|
||||
{
|
||||
addJob(createVolumeGroupJob());
|
||||
}
|
||||
|
@ -50,10 +51,16 @@ bool CreateVolumeGroupOperation::targets(const Partition& part) const
|
|||
|
||||
void CreateVolumeGroupOperation::preview()
|
||||
{
|
||||
LvmDevice::s_DirtyPVs << PVList();
|
||||
}
|
||||
|
||||
void CreateVolumeGroupOperation::undo()
|
||||
{
|
||||
foreach(QString pvpath, PVList()) {
|
||||
if (LvmDevice::s_DirtyPVs.contains(pvpath)) {
|
||||
LvmDevice::s_DirtyPVs.removeAll(pvpath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CreateVolumeGroupOperation::canCreate()
|
||||
|
|
|
@ -61,8 +61,13 @@ protected:
|
|||
return m_CreateVolumeGroupJob;
|
||||
}
|
||||
|
||||
QStringList PVList() {
|
||||
return m_PVList;
|
||||
}
|
||||
|
||||
private:
|
||||
CreateVolumeGroupJob* m_CreateVolumeGroupJob;
|
||||
QStringList m_PVList;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue