Store list of physical volumes in a global variable.

This commit is contained in:
Andrius Štikonas 2016-11-03 13:26:14 +00:00
parent 36202cc1ad
commit 5d2bb2f8af
4 changed files with 8 additions and 12 deletions

View File

@ -66,7 +66,7 @@ void DeviceScanner::scan()
const QList<Device*> deviceList = CoreBackendManager::self()->backend()->scanDevices();
const QList<LvmDevice*> lvmList = LvmDevice::scanSystemLVM();
operationStack().physicalVolumes() = FS::lvm2_pv::getPVs(deviceList);
LVM::pvList = FS::lvm2_pv::getPVs(deviceList);
for (const auto &d : deviceList)
operationStack().addDevice(d);
@ -75,12 +75,12 @@ void DeviceScanner::scan()
for (const auto &d : lvmList) {
operationStack().addDevice(d);
operationStack().physicalVolumes().append(FS::lvm2_pv::getPVinNode(d->partitionTable()));
LVM::pvList.append(FS::lvm2_pv::getPVinNode(d->partitionTable()));
}
// Store list of physical volumes in LvmDevice
for (const auto &d : lvmList)
for (const auto &p : operationStack().physicalVolumes())
for (const auto &p : LVM::pvList) // FIXME: qAsConst
if (p.vgName() == d->name())
d->physicalVolumes().append(p.partition());
}

View File

@ -19,7 +19,6 @@
#define OPERATIONSTACK__H
#include "fs/lvm2_pv.h"
#include "util/libpartitionmanagerexport.h"
#include <QObject>
@ -75,13 +74,6 @@ public:
return m_PreviewDevices; /**< @return the list of Devices */
}
QList<LvmPV>& physicalVolumes() {
return m_LVMPhysicalVolumes; /**< @return the list of LVM PVs */
}
const QList<LvmPV>& physicalVolumes() const {
return m_LVMPhysicalVolumes; /**< @return the list of LVM PVs */
}
Operations& operations() {
return m_Operations; /**< @return the list of operations */
}
@ -110,7 +102,6 @@ protected:
private:
Operations m_Operations;
mutable Devices m_PreviewDevices;
mutable QList<LvmPV> m_LVMPhysicalVolumes;
QReadWriteLock m_Lock;
};

View File

@ -289,6 +289,8 @@ QList<LvmPV> lvm2_pv::getPVs(const QList<Device*>& devices)
}
QList<LvmPV> LVM::pvList;
LvmPV::LvmPV(const QString vgName, const Partition* p, bool isLuks)
: m_vgName(vgName)
, m_p(p)

View File

@ -57,6 +57,9 @@ private:
bool m_isLuks;
};
namespace LVM {
extern LIBKPMCORE_EXPORT QList<LvmPV> pvList;
}
namespace FS
{