Use cached values for resizing volume groups.

This commit is contained in:
Andrius Štikonas 2016-09-24 21:09:11 +01:00
parent aa5daf0378
commit 9c7db501bf
3 changed files with 7 additions and 4 deletions

View File

@ -64,6 +64,10 @@ public:
virtual bool operator==(const Device& other) const;
virtual bool operator!=(const Device& other) const;
virtual QString& name() {
return m_Name; /**< @return the Device's name, usually some manufacturer string */
}
virtual const QString& name() const {
return m_Name; /**< @return the Device's name, usually some manufacturer string */
}

View File

@ -78,8 +78,9 @@ ResizeVolumeGroupOperation::ResizeVolumeGroupOperation(LvmDevice& d, const QList
movePE += lvm2PVFs->allocatedPE();
}
qint64 growPE = 0;
for (const auto &p : toInsertList) // FIXME: qAsConst
growPE += p->capacity() / LvmDevice::getPeSize(d.name());
for (const auto &p : toInsertList) { // FIXME: qAsConst
growPE += p->capacity() / device().peSize();
}
if ( movePE > (freePE + growPE)) {
// *ABORT* can't move

View File

@ -20,8 +20,6 @@
#include "util/report.h"
#include <cstdlib>
#include <QString>
#include <QStringList>