Remove unused parameters from LvmDevice.

This commit is contained in:
Chantara Tith 2016-08-11 21:51:52 +07:00 committed by Andrius Štikonas
parent 6fd0c7a0db
commit 69536b1129
5 changed files with 13 additions and 19 deletions

View File

@ -370,9 +370,8 @@ bool LvmDevice::createLV(Report& report, LvmDevice& dev, Partition& part, const
return (cmd.run(-1) && cmd.exitCode() == 0);
}
bool LvmDevice::createLVSnapshot(Report& report, LvmDevice& dev, Partition& lvpart, const QString& name, const qint64 extents)
bool LvmDevice::createLVSnapshot(Report& report, Partition& lvpart, const QString& name, const qint64 extents)
{
Q_UNUSED(dev);
QString numExtents = (extents > 0) ? QString::number(extents) :
QString::number(lvpart.length());
ExternalCommand cmd(report, QStringLiteral("lvm"),
@ -387,9 +386,8 @@ bool LvmDevice::createLVSnapshot(Report& report, LvmDevice& dev, Partition& lvpa
return (cmd.run(-1) && cmd.exitCode() == 0);
}
bool LvmDevice::resizeLV(Report& report, LvmDevice& dev, Partition& part)
bool LvmDevice::resizeLV(Report& report, Partition& part)
{
Q_UNUSED(dev);
//TODO: thorough tests and add warning that it could currupt the user data.
ExternalCommand cmd(report, QStringLiteral("lvm"),
{ QStringLiteral("lvresize"),
@ -423,9 +421,8 @@ bool LvmDevice::insertPV(Report& report, LvmDevice& dev, const QString& pvPath)
return (cmd.run(-1) && cmd.exitCode() == 0);
}
bool LvmDevice::movePV(Report& report, LvmDevice& dev, const QString& pvPath, const QStringList& destinations)
bool LvmDevice::movePV(Report& report, const QString& pvPath, const QStringList& destinations)
{
Q_UNUSED(dev);
if (FS::lvm2_pv::getAllocatedPE(pvPath) <= 0) {
return true;
@ -475,9 +472,8 @@ bool LvmDevice::deactivateVG(Report& report, const LvmDevice& dev)
return deactivate.run(-1) && deactivate.exitCode() == 0;
}
bool LvmDevice::deactivateLV(Report& report, const LvmDevice& dev, const Partition& part)
bool LvmDevice::deactivateLV(Report& report, const Partition& part)
{
Q_UNUSED(dev);
ExternalCommand deactivate(report, QStringLiteral("lvm"),
{ QStringLiteral("lvchange"),
QStringLiteral("--activate"), QStringLiteral("n"),
@ -494,9 +490,8 @@ bool LvmDevice::activateVG(Report& report, const LvmDevice& dev)
return deactivate.run(-1) && deactivate.exitCode() == 0;
}
bool LvmDevice::activateLV(Report& report, LvmDevice& dev, Partition& part)
bool LvmDevice::activateLV(Report& report, Partition& part)
{
Q_UNUSED(dev);
ExternalCommand deactivate(report, QStringLiteral("lvm"),
{ QStringLiteral("lvchange"),
QStringLiteral("--activate"), QStringLiteral("y"),

View File

@ -73,14 +73,14 @@ public:
static bool removeLV(Report& report, LvmDevice& dev, Partition& part);
static bool createLV(Report& report, LvmDevice& dev, Partition& part, const QString& lvname);
static bool createLVSnapshot(Report& report, LvmDevice& dev, Partition& lvpart, const QString& name, const qint64 extents = 0);
static bool resizeLV(Report& report, LvmDevice& dev, Partition& part);
static bool deactivateLV(Report& report, const LvmDevice& dev, const Partition& part);
static bool activateLV(Report& report, LvmDevice& dev, Partition& part);
static bool createLVSnapshot(Report& report, Partition& lvpart, const QString& name, const qint64 extents = 0);
static bool resizeLV(Report& report, Partition& part);
static bool deactivateLV(Report& report, const Partition& part);
static bool activateLV(Report& report, Partition& part);
static bool removePV(Report& report, LvmDevice& dev, const QString& pvPath);
static bool insertPV(Report& report, LvmDevice& dev, const QString& pvPath);
static bool movePV(Report& report, LvmDevice& dev, const QString& pvPath, const QStringList& destinations = QStringList());
static bool movePV(Report& report, const QString& pvPath, const QStringList& destinations = QStringList());
static bool removeVG(Report& report, LvmDevice& dev);
static bool createVG(Report& report, const QString vgname, const QStringList pvlist, const qint32 peSize = 4); // peSize in megabytes

View File

@ -43,7 +43,7 @@ bool DeactivateLogicalVolumeJob::run(Report& parent)
if (device().type() == Device::LVM_Device) {
for (const auto &p : device().partitionTable()->children()) {
if (!p->roles().has(PartitionRole::Unallocated)) {
if (!LvmDevice::deactivateLV(*report, dynamic_cast<const LvmDevice&>(device()), *p)) {
if (!LvmDevice::deactivateLV(*report, *p)) {
rval = false;
}
}

View File

@ -46,7 +46,7 @@ bool MovePhysicalVolumeJob::run(Report& parent)
}
for (const auto &partPath : partList()) {
rval = LvmDevice::movePV(*report, device(), partPath, destinations);
rval = LvmDevice::movePV(*report, partPath, destinations);
if (rval == false) {
break;
}

View File

@ -78,12 +78,11 @@ bool SetPartGeometryJob::run(Report& parent)
} else
report->line() << xi18nc("@info:progress", "Could not open device <filename>%1</filename> while trying to resize/move partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
} else if (device().type() == Device::LVM_Device) {
LvmDevice& dev = dynamic_cast<LvmDevice&>(device());
partition().setFirstSector(newStart());
partition().setLastSector(newStart() + newLength() - 1);
rval = LvmDevice::resizeLV(*report, dev, partition());
rval = LvmDevice::resizeLV(*report, partition());
}
jobFinished(*report, rval);