Remove some no longer necessary functions.
This commit is contained in:
parent
28478ee0ad
commit
ef7680030c
|
@ -123,7 +123,6 @@ bool lvm2_pv::create(Report& report, const QString& deviceNode)
|
|||
|
||||
bool lvm2_pv::remove(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
// TODO: check if PV is a member of an exported VG
|
||||
ExternalCommand cmd(report, QStringLiteral("lvm"), { QStringLiteral("pvremove"), QStringLiteral("--force"), QStringLiteral("--force"), QStringLiteral("--yes"), deviceNode });
|
||||
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||
}
|
||||
|
@ -186,7 +185,7 @@ bool lvm2_pv::unmount(Report& report, const QString& deviceNode)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool lvm2_pv::canMount(const QString & deviceNode, const QString & mountPoint) const
|
||||
bool lvm2_pv::canMount(const QString& deviceNode, const QString& mountPoint) const
|
||||
{
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(mountPoint);
|
||||
|
@ -205,79 +204,17 @@ qint64 lvm2_pv::getTotalPE(const QString& deviceNode)
|
|||
return val.isEmpty() ? -1 : val.toLongLong();
|
||||
}
|
||||
|
||||
qint64 lvm2_pv::getTotalPE(const QStringList& deviceNodeList)
|
||||
{
|
||||
qint64 sum = 0;
|
||||
for (const auto &deviceNode : deviceNodeList) {
|
||||
qint64 totalPE = getTotalPE(deviceNode);
|
||||
if (totalPE < 0) {
|
||||
sum = -1;
|
||||
break;
|
||||
}
|
||||
sum += totalPE;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
qint64 lvm2_pv::getFreePE(const QString& deviceNode)
|
||||
{
|
||||
return getTotalPE(deviceNode) - getAllocatedPE(deviceNode);
|
||||
}
|
||||
|
||||
qint64 lvm2_pv::getFreePE(const QStringList& deviceNodeList)
|
||||
{
|
||||
qint64 sum = 0;
|
||||
for (QString deviceNode :deviceNodeList) {
|
||||
qint64 freePE = getFreePE(deviceNode);
|
||||
if (freePE < 0) {
|
||||
sum = -1;
|
||||
break;
|
||||
}
|
||||
sum += freePE;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
qint64 lvm2_pv::getAllocatedPE(const QString& deviceNode)
|
||||
{
|
||||
QString val = getpvField(QStringLiteral("pv_pe_alloc_count"), deviceNode);
|
||||
return val.isEmpty() ? -1 : val.toLongLong();
|
||||
}
|
||||
|
||||
qint64 lvm2_pv::getAllocatedPE(const QStringList& deviceNodeList)
|
||||
{
|
||||
qint64 sum = 0;
|
||||
for (QString deviceNode : deviceNodeList) {
|
||||
qint64 allocatedPE = getAllocatedPE(deviceNode);
|
||||
if (allocatedPE < 0) {
|
||||
sum = -1;
|
||||
break;
|
||||
}
|
||||
sum += allocatedPE;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
qint64 lvm2_pv::getPVSize(const QString& deviceNode)
|
||||
{
|
||||
QString val = getpvField(QStringLiteral("pv_size"), deviceNode);
|
||||
return val.isEmpty() ? -1 : val.toLongLong();
|
||||
}
|
||||
|
||||
qint64 lvm2_pv::getPVSize(const QStringList& deviceNodeList)
|
||||
{
|
||||
qint64 sum = 0;
|
||||
for (QString deviceNode : deviceNodeList) {
|
||||
qint64 pvsize = getPVSize(deviceNode);
|
||||
if (pvsize < 0) {
|
||||
sum = -1;
|
||||
break;
|
||||
}
|
||||
sum += pvsize;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
void lvm2_pv::getPESize(const QString& deviceNode)
|
||||
{
|
||||
QString val = getpvField(QStringLiteral("vg_extent_size"), deviceNode);
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
bool updateUUID(Report& report, const QString& deviceNode) const override;
|
||||
QString readUUID(const QString& deviceNode) const override;
|
||||
|
||||
bool canMount(const QString & deviceNode, const QString & mountPoint) const override;
|
||||
bool canMount(const QString& deviceNode, const QString& mountPoint) const override;
|
||||
bool canUnmount(const QString& deviceNode) const override;
|
||||
|
||||
bool mount(Report& report, const QString& deviceNode, const QString& mountPoint) override; // mountPoint == VG name
|
||||
|
@ -108,14 +108,8 @@ public:
|
|||
static QString getpvField(const QString& fieldName, const QString& deviceNode = QString());
|
||||
|
||||
static qint64 getTotalPE(const QString& deviceNode);
|
||||
static qint64 getTotalPE(const QStringList& deviceNodeList);
|
||||
static qint64 getFreePE(const QString& deviceNode);
|
||||
static qint64 getFreePE(const QStringList& deviceNodeList);
|
||||
static qint64 getAllocatedPE(const QString& deviceNode);
|
||||
static qint64 getAllocatedPE(const QStringList& deviceNodeList);
|
||||
void getPESize(const QString& deviceNode); // return PE size in bytes
|
||||
static qint64 getPVSize(const QString& deviceNode); // return PV size in bytes
|
||||
static qint64 getPVSize(const QStringList& deviceNodeList);
|
||||
static QString getVGName(const QString& deviceNode);
|
||||
static PhysicalVolumes getPVinNode(const PartitionNode* parent);
|
||||
static PhysicalVolumes getPVs(const QList<Device*>& devices);
|
||||
|
@ -125,6 +119,9 @@ public:
|
|||
qint64 totalPE() const { return m_TotalPE; };
|
||||
qint64 peSize() const { return m_PESize; };
|
||||
|
||||
private:
|
||||
void getPESize(const QString& deviceNode); // return PE size in bytes
|
||||
|
||||
public:
|
||||
static CommandSupportType m_GetUsed;
|
||||
static CommandSupportType m_GetLabel;
|
||||
|
|
|
@ -75,7 +75,7 @@ ResizeVolumeGroupOperation::ResizeVolumeGroupOperation(LvmDevice& d, const QList
|
|||
}
|
||||
qint64 growPE = 0;
|
||||
for (const auto &p : toInsertList) // FIXME: qAsConst
|
||||
growPE += FS::lvm2_pv::getPVSize(p->partitionPath()) / LvmDevice::getPeSize(d.name());
|
||||
growPE += p->capacity() / LvmDevice::getPeSize(d.name());
|
||||
|
||||
if ( movePE > (freePE + growPE)) {
|
||||
// *ABORT* can't move
|
||||
|
|
Loading…
Reference in New Issue