A small dirty hack to keep track of all the PVs that to be added to any VG.

This commit is contained in:
Chantara Tith 2016-08-08 14:03:58 +07:00 committed by Andrius Štikonas
parent 6915187fb2
commit 25bbce4975
4 changed files with 16 additions and 1 deletions

View File

@ -56,6 +56,8 @@ LvmDevice::LvmDevice(const QString& name, const QString& iconname)
initPartitions(); initPartitions();
} }
QStringList LvmDevice::s_DirtyPVs;
LvmDevice::~LvmDevice() LvmDevice::~LvmDevice()
{ {
delete m_PVPathList; delete m_PVPathList;

View File

@ -53,6 +53,7 @@ public:
Partition* scanPartition(const QString& lvPath, PartitionTable* pTable) const; Partition* scanPartition(const QString& lvPath, PartitionTable* pTable) const;
QStringList deviceNodeList() const override; QStringList deviceNodeList() const override;
QStringList lvPathList() const; QStringList lvPathList() const;
static QStringList s_DirtyPVs;
public: public:
static QList<LvmDevice*> scanSystemLVM(); static QList<LvmDevice*> scanSystemLVM();

View File

@ -32,7 +32,8 @@
*/ */
CreateVolumeGroupOperation::CreateVolumeGroupOperation(const QString& vgname, const QStringList& pvlist, const qint32 pesize) : CreateVolumeGroupOperation::CreateVolumeGroupOperation(const QString& vgname, const QStringList& pvlist, const qint32 pesize) :
Operation(), Operation(),
m_CreateVolumeGroupJob(new CreateVolumeGroupJob(vgname, pvlist, pesize)) m_CreateVolumeGroupJob(new CreateVolumeGroupJob(vgname, pvlist, pesize)),
m_PVList(pvlist)
{ {
addJob(createVolumeGroupJob()); addJob(createVolumeGroupJob());
} }
@ -50,10 +51,16 @@ bool CreateVolumeGroupOperation::targets(const Partition& part) const
void CreateVolumeGroupOperation::preview() void CreateVolumeGroupOperation::preview()
{ {
LvmDevice::s_DirtyPVs << PVList();
} }
void CreateVolumeGroupOperation::undo() void CreateVolumeGroupOperation::undo()
{ {
foreach(QString pvpath, PVList()) {
if (LvmDevice::s_DirtyPVs.contains(pvpath)) {
LvmDevice::s_DirtyPVs.removeAll(pvpath);
}
}
} }
bool CreateVolumeGroupOperation::canCreate() bool CreateVolumeGroupOperation::canCreate()

View File

@ -61,8 +61,13 @@ protected:
return m_CreateVolumeGroupJob; return m_CreateVolumeGroupJob;
} }
QStringList PVList() {
return m_PVList;
}
private: private:
CreateVolumeGroupJob* m_CreateVolumeGroupJob; CreateVolumeGroupJob* m_CreateVolumeGroupJob;
QStringList m_PVList;
}; };
#endif #endif