Add LvmDevice createVG.

This commit is contained in:
Chantara Tith 2016-06-29 22:08:32 +07:00
parent 0ab8227d94
commit 2770da7da6
2 changed files with 15 additions and 0 deletions

View File

@ -320,3 +320,16 @@ bool LvmDevice::insertPV(Report& report, LvmDevice& dev, const QString& pvPath)
return (cmd.run(-1) && cmd.exitCode() == 0);
}
bool LvmDevice::createVG(Report& report, const QString vgname, const QList<Partition*> pvlist)
{
//TODO: check that all the pv in pvlist is lvm2_pv
QStringList args = QStringList();
args << QStringLiteral("vgcreate") << vgname;
foreach (Partition* p, pvlist) {
args << p->partitionPath();
}
ExternalCommand cmd(report, QStringLiteral("lvm"), args);
return (cmd.run(-1) && cmd.exitCode() == 0);
}

View File

@ -68,6 +68,8 @@ public:
static bool removePV(Report& report, LvmDevice& dev, const QString& pvPath);
static bool insertPV(Report& report, LvmDevice& dev, const QString& pvPath);
static bool createVG(Report& report, const QString vgname, const QList<Partition*> pvlist);
protected:
void initPartitions();
QList<QString> deviceNodeList() const override;