Add activating LVM LV and VG.

This commit is contained in:
Chantara Tith 2016-08-08 13:05:35 +07:00 committed by Andrius Štikonas
parent 3b26d39d3c
commit 6915187fb2
2 changed files with 21 additions and 0 deletions

View File

@ -471,3 +471,22 @@ bool LvmDevice::deactivateLV(Report& report, LvmDevice& dev, Partition& part)
part.partitionPath() });
return deactivate.run(-1) && deactivate.exitCode() == 0;
}
bool LvmDevice::activateVG(Report& report, const LvmDevice& dev)
{
ExternalCommand deactivate(report, QStringLiteral("lvm"),
{ QStringLiteral("vgchange"),
QStringLiteral("--activate"), QStringLiteral("y"),
dev.name() });
return deactivate.run(-1) && deactivate.exitCode() == 0;
}
bool LvmDevice::activateLV(Report& report, LvmDevice& dev, Partition& part)
{
Q_UNUSED(dev);
ExternalCommand deactivate(report, QStringLiteral("lvm"),
{ QStringLiteral("lvchange"),
QStringLiteral("--activate"), QStringLiteral("y"),
part.partitionPath() });
return deactivate.run(-1) && deactivate.exitCode() == 0;
}

View File

@ -75,6 +75,7 @@ public:
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, LvmDevice& dev, Partition& part);
static bool activateLV(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);
@ -83,6 +84,7 @@ public:
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
static bool deactivateVG(Report& report, const LvmDevice& dev);
static bool activateVG(Report& report, const LvmDevice& dev);
protected:
void initPartitions();