LVM support #6

Closed
andrius wants to merge 109 commits from (deleted):lvm-support-rebase into master
3 changed files with 9 additions and 4 deletions
Showing only changes of commit a298800fe2 - Show all commits

View File

@ -282,13 +282,14 @@ bool LvmDevice::createLV(Report& report, LvmDevice& dev, Partition& part, const
return (cmd.run(-1) && cmd.exitCode() == 0);
}
bool LvmDevice::resizeLv(Report& report, LvmDevice& dev, Partition& part)
bool LvmDevice::resizeLV(Report& report, LvmDevice& dev, Partition& part)
{
Q_UNUSED(dev);
//TODO: through tests
//TODO: through tests and add warning that it could currupt the user data.
ExternalCommand cmd(report, QStringLiteral("lvm"),
{ QStringLiteral("lvresize"),
//QStringLiteral("--yes"), // this command could corrupt user data
QStringLiteral("--force"), // this command could corrupt user data
QStringLiteral("--yes"),
QStringLiteral("--extents"),
QString::number(part.length()),
part.partitionPath()});

View File

@ -63,7 +63,7 @@ public:
static bool removeLV(Report& report, LvmDevice& dev, Partition& part);
static bool createLV(Report& report, LvmDevice& dev, Partition& part, const QString& lvname);
static bool resizeLv(Report& report, LvmDevice& dev, Partition& part);
static bool resizeLV(Report& report, LvmDevice& dev, Partition& part);
static bool removePV(Report& report, LvmDevice& dev, const QString& pvPath);
static bool insertPV(Report& report, LvmDevice& dev, const QString& pvPath);

View File

@ -25,6 +25,7 @@
#include "core/partition.h"
#include "core/device.h"
#include "core/lvmdevice.h"
#include "util/report.h"
@ -77,9 +78,12 @@ 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());
//TODO: resize given LVM LV
partition().setFirstSector(newStart());
partition().setLastSector(newStart() + newLength() - 1);
rval = LvmDevice::resizeLV(*report, dev, partition());
}
jobFinished(*report, rval);