Add functionality to specify PE size when creating VG group.
This commit is contained in:
parent
10696c87a7
commit
7642a516c5
|
@ -354,11 +354,12 @@ bool LvmDevice::movePV(Report& report, LvmDevice& dev, const QString& pvPath, co
|
||||||
return (cmd.run(-1) && cmd.exitCode() == 0);
|
return (cmd.run(-1) && cmd.exitCode() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LvmDevice::createVG(Report& report, const QString vgname, const QStringList pvlist)
|
bool LvmDevice::createVG(Report& report, const QString vgname, const QStringList pvlist, const qint32 peSize)
|
||||||
{
|
{
|
||||||
//TODO: check that all the pv in pvlist is lvm2_pv
|
//TODO: check that all the pv in pvlist is lvm2_pv
|
||||||
QStringList args = QStringList();
|
QStringList args = QStringList();
|
||||||
args << QStringLiteral("vgcreate") << vgname;
|
args << QStringLiteral("vgcreate") << QStringLiteral("--physicalextentsize") << QString::number(peSize);
|
||||||
|
args << vgname;
|
||||||
foreach (QString pvnode, pvlist) {
|
foreach (QString pvnode, pvlist) {
|
||||||
args << pvnode.trimmed();
|
args << pvnode.trimmed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
static bool movePV(Report& report, LvmDevice& dev, const QString& pvPath, const QStringList& destinations = QStringList());
|
static bool movePV(Report& report, LvmDevice& dev, const QString& pvPath, const QStringList& destinations = QStringList());
|
||||||
|
|
||||||
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);
|
static bool createVG(Report& report, const QString vgname, const QStringList pvlist, const qint32 peSize = 4); // peSize in megabytes
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initPartitions();
|
void initPartitions();
|
||||||
|
|
|
@ -27,10 +27,11 @@
|
||||||
@param vgname
|
@param vgname
|
||||||
@parem pvList
|
@parem pvList
|
||||||
*/
|
*/
|
||||||
CreateVolumeGroupJob::CreateVolumeGroupJob(const QString& vgname, const QStringList& pvlist) :
|
CreateVolumeGroupJob::CreateVolumeGroupJob(const QString& vgname, const QStringList& pvlist, const qint32 pesize) :
|
||||||
Job(),
|
Job(),
|
||||||
m_vgName(vgname),
|
m_vgName(vgname),
|
||||||
m_pvList(pvlist)
|
m_pvList(pvlist),
|
||||||
|
m_PESize(pesize)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ bool CreateVolumeGroupJob::run(Report& parent)
|
||||||
|
|
||||||
Report* report = jobStarted(parent);
|
Report* report = jobStarted(parent);
|
||||||
|
|
||||||
rval = LvmDevice::createVG(*report, vgName(), pvList());
|
rval = LvmDevice::createVG(*report, vgName(), pvList(), peSize());
|
||||||
|
|
||||||
jobFinished(*report, rval);
|
jobFinished(*report, rval);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class QString;
|
||||||
class CreateVolumeGroupJob : public Job
|
class CreateVolumeGroupJob : public Job
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CreateVolumeGroupJob(const QString& vgname, const QStringList& pvlist);
|
CreateVolumeGroupJob(const QString& vgname, const QStringList& pvlist, const qint32 pesize);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool run(Report& parent) override;
|
bool run(Report& parent) override;
|
||||||
|
@ -50,9 +50,14 @@ protected:
|
||||||
return m_pvList;
|
return m_pvList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qint32 peSize() {
|
||||||
|
return m_PESize;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_vgName;
|
QString m_vgName;
|
||||||
QStringList m_pvList;
|
QStringList m_pvList;
|
||||||
|
qint32 m_PESize;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
@param d the Device to create the new PartitionTable on
|
@param d the Device to create the new PartitionTable on
|
||||||
@param t the type for the new PartitionTable
|
@param t the type for the new PartitionTable
|
||||||
*/
|
*/
|
||||||
CreateVolumeGroupOperation::CreateVolumeGroupOperation(const QString& vgname, const QStringList& pvlist) :
|
CreateVolumeGroupOperation::CreateVolumeGroupOperation(const QString& vgname, const QStringList& pvlist, const qint32 pesize) :
|
||||||
Operation(),
|
Operation(),
|
||||||
m_CreateVolumeGroupJob(new CreateVolumeGroupJob(vgname, pvlist))
|
m_CreateVolumeGroupJob(new CreateVolumeGroupJob(vgname, pvlist, pesize))
|
||||||
{
|
{
|
||||||
addJob(createVolumeGroupJob());
|
addJob(createVolumeGroupJob());
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ QString CreateVolumeGroupOperation::description() const
|
||||||
|
|
||||||
bool CreateVolumeGroupOperation::targets(const Partition& part) const
|
bool CreateVolumeGroupOperation::targets(const Partition& part) const
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(part)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class LIBKPMCORE_EXPORT CreateVolumeGroupOperation : public Operation
|
||||||
friend class OperationStack;
|
friend class OperationStack;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CreateVolumeGroupOperation(const QString& vgname, const QStringList& pvlist);
|
CreateVolumeGroupOperation(const QString& vgname, const QStringList& pvlist, const qint32 pesize = 4);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString iconName() const override {
|
QString iconName() const override {
|
||||||
|
|
Loading…
Reference in New Issue