diff --git a/src/core/lvmdevice.cpp b/src/core/lvmdevice.cpp index ad73c52..f572e19 100644 --- a/src/core/lvmdevice.cpp +++ b/src/core/lvmdevice.cpp @@ -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; +} diff --git a/src/core/lvmdevice.h b/src/core/lvmdevice.h index f6732ff..19d4b62 100644 --- a/src/core/lvmdevice.h +++ b/src/core/lvmdevice.h @@ -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();