Add deactivating LVM LV and VG.
This commit is contained in:
parent
5befd7484e
commit
ca2bbb27d7
|
@ -446,15 +446,28 @@ bool LvmDevice::createVG(Report& report, const QString vgname, const QStringList
|
||||||
|
|
||||||
bool LvmDevice::removeVG(Report& report, LvmDevice& dev)
|
bool LvmDevice::removeVG(Report& report, LvmDevice& dev)
|
||||||
{
|
{
|
||||||
bool deactivated = false;
|
bool deactivated = deactivateVG(report, dev);
|
||||||
ExternalCommand deactivate(report, QStringLiteral("lvm"),
|
|
||||||
{ QStringLiteral("vgchange"),
|
|
||||||
QStringLiteral("--activate"), QStringLiteral("n"),
|
|
||||||
dev.name() });
|
|
||||||
deactivated = deactivate.run(-1) && deactivate.exitCode() == 0;
|
|
||||||
|
|
||||||
ExternalCommand cmd(report, QStringLiteral("lvm"),
|
ExternalCommand cmd(report, QStringLiteral("lvm"),
|
||||||
{ QStringLiteral("vgremove"),
|
{ QStringLiteral("vgremove"),
|
||||||
dev.name() });
|
dev.name() });
|
||||||
return (deactivated && cmd.run(-1) && cmd.exitCode() == 0);
|
return (deactivated && cmd.run(-1) && cmd.exitCode() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LvmDevice::deactivateVG(Report& report, const LvmDevice& dev)
|
||||||
|
{
|
||||||
|
ExternalCommand deactivate(report, QStringLiteral("lvm"),
|
||||||
|
{ QStringLiteral("vgchange"),
|
||||||
|
QStringLiteral("--activate"), QStringLiteral("n"),
|
||||||
|
dev.name() });
|
||||||
|
return deactivate.run(-1) && deactivate.exitCode() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LvmDevice::deactivateLV(Report& report, LvmDevice& dev, Partition& part)
|
||||||
|
{
|
||||||
|
Q_UNUSED(dev);
|
||||||
|
ExternalCommand deactivate(report, QStringLiteral("lvm"),
|
||||||
|
{ QStringLiteral("lvchange"),
|
||||||
|
QStringLiteral("--activate"), QStringLiteral("n"),
|
||||||
|
part.partitionPath() });
|
||||||
|
return deactivate.run(-1) && deactivate.exitCode() == 0;
|
||||||
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ public:
|
||||||
static bool createLV(Report& report, LvmDevice& dev, Partition& part, const QString& lvname);
|
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 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 resizeLV(Report& report, LvmDevice& dev, Partition& part);
|
||||||
|
static bool deactivateLV(Report& report, LvmDevice& dev, Partition& part);
|
||||||
|
|
||||||
static bool removePV(Report& report, LvmDevice& dev, const QString& pvPath);
|
static bool removePV(Report& report, LvmDevice& dev, const QString& pvPath);
|
||||||
static bool insertPV(Report& report, LvmDevice& dev, const QString& pvPath);
|
static bool insertPV(Report& report, LvmDevice& dev, const QString& pvPath);
|
||||||
|
@ -81,6 +82,7 @@ public:
|
||||||
|
|
||||||
static bool removeVG(Report& report, LvmDevice& dev);
|
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 createVG(Report& report, const QString vgname, const QStringList pvlist, const qint32 peSize = 4); // peSize in megabytes
|
||||||
|
static bool deactivateVG(Report& report, const LvmDevice& dev);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initPartitions();
|
void initPartitions();
|
||||||
|
|
Loading…
Reference in New Issue