LVM support #6
|
@ -333,7 +333,7 @@ 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)
|
||||
bool LvmDevice::movePV(Report& report, LvmDevice& dev, const QString& pvPath, const QStringList& destinations)
|
||||
{
|
||||
Q_UNUSED(dev);
|
||||
|
||||
|
@ -341,9 +341,16 @@ bool LvmDevice::movePV(Report& report, LvmDevice& dev, const QString& pvPath)
|
|||
return true;
|
||||
}
|
||||
|
||||
ExternalCommand cmd(report, QStringLiteral("lvm"),
|
||||
{ QStringLiteral("pvmove"),
|
||||
pvPath});
|
||||
QStringList args = QStringList();
|
||||
args << QStringLiteral("pvmove");
|
||||
args << pvPath;
|
||||
if (!destinations.isEmpty()) {
|
||||
foreach (QString destPath, destinations) {
|
||||
args << destPath.trimmed();
|
||||
}
|
||||
}
|
||||
|
||||
ExternalCommand cmd(report, QStringLiteral("lvm"), args);
|
||||
return (cmd.run(-1) && cmd.exitCode() == 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
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);
|
||||
static bool movePV(Report& report, LvmDevice& dev, 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);
|
||||
|
|
|
@ -41,8 +41,16 @@ bool MovePhysicalVolumeJob::run(Report& parent)
|
|||
Report* report = jobStarted(parent);
|
||||
|
||||
//TODO:check that the provided list is legal
|
||||
|
||||
QStringList destinations = LvmDevice::getPVs(device().name());
|
||||
foreach (QString partPath, partList()) {
|
||||
rval = LvmDevice::movePV(*report, device(), partPath);
|
||||
if (destinations.contains(partPath)) {
|
||||
destinations.removeAll(partPath);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (QString partPath, partList()) {
|
||||
rval = LvmDevice::movePV(*report, device(), partPath, destinations);
|
||||
if (rval == false) {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue