LVM support #6
|
@ -27,7 +27,7 @@
|
|||
@param vgname
|
||||
@parem pvList
|
||||
*/
|
||||
CreateVolumeGroupJob::CreateVolumeGroupJob(const QString& vgname, const QList<Partition*> pvlist) :
|
||||
CreateVolumeGroupJob::CreateVolumeGroupJob(const QString& vgname, const QStringList& pvlist) :
|
||||
Job(),
|
||||
m_vgName(vgname),
|
||||
m_pvList(pvlist)
|
||||
|
@ -49,5 +49,9 @@ bool CreateVolumeGroupJob::run(Report& parent)
|
|||
|
||||
QString CreateVolumeGroupJob::description() const
|
||||
{
|
||||
return xi18nc("@info/plain", "Create new Volume Group named <filename>%1</filename>", vgName());
|
||||
QString tmp = QString();
|
||||
foreach(QString name, pvList()) {
|
||||
tmp += QStringLiteral("\n") + name;
|
||||
}
|
||||
return xi18nc("@info/plain", "Create new Volume Group: <filename>%1</filename> with PV: %2", vgName(), tmp);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class QString;
|
|||
class CreateVolumeGroupJob : public Job
|
||||
{
|
||||
public:
|
||||
CreateVolumeGroupJob(const QString& vgname, const QList<Partition*> pvlist);
|
||||
CreateVolumeGroupJob(const QString& vgname, const QStringList& pvlist);
|
||||
|
||||
public:
|
||||
bool run(Report& parent) override;
|
||||
|
@ -43,16 +43,16 @@ protected:
|
|||
const QString vgName() const {
|
||||
return m_vgName;
|
||||
}
|
||||
QList<Partition*> pvList() {
|
||||
QStringList pvList() {
|
||||
return m_pvList;
|
||||
}
|
||||
const QList<Partition*> pvList() const {
|
||||
const QStringList pvList() const {
|
||||
return m_pvList;
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_vgName;
|
||||
QList<Partition*> m_pvList;
|
||||
QStringList m_pvList;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "ops/createvolumegroupoperation.h"
|
||||
|
||||
#include "core/lvmdevice.h"
|
||||
#include "fs/lvm2_pv.h"
|
||||
|
||||
#include "jobs/createvolumegroupjob.h"
|
||||
|
||||
|
@ -29,32 +30,21 @@
|
|||
@param d the Device to create the new PartitionTable on
|
||||
@param t the type for the new PartitionTable
|
||||
*/
|
||||
CreateVolumeGroupOperation::CreateVolumeGroupOperation(const QString& vgname, const QList<Partition*> pvlist) :
|
||||
CreateVolumeGroupOperation::CreateVolumeGroupOperation(const QString& vgname, const QStringList& pvlist) :
|
||||
Operation(),
|
||||
m_CreateVolumeGroupJob(new CreateVolumeGroupJob(vgname, pvlist))
|
||||
{
|
||||
addJob(createVolumeGroupJob());
|
||||
}
|
||||
|
||||
bool CreateVolumeGroupOperation::canCreate()
|
||||
{
|
||||
//TODO: return true if there is any free PV
|
||||
return true;
|
||||
}
|
||||
|
||||
QString CreateVolumeGroupOperation::description() const
|
||||
{
|
||||
return xi18nc("@info/plain", "Create a new LVM volume group.");
|
||||
}
|
||||
|
||||
bool CreateVolumeGroupOperation::targets(const Device&) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CreateVolumeGroupOperation::targets(const Partition& part) const
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void CreateVolumeGroupOperation::preview()
|
||||
|
@ -64,3 +54,8 @@ void CreateVolumeGroupOperation::preview()
|
|||
void CreateVolumeGroupOperation::undo()
|
||||
{
|
||||
}
|
||||
|
||||
bool CreateVolumeGroupOperation::canCreate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class LIBKPMCORE_EXPORT CreateVolumeGroupOperation : public Operation
|
|||
friend class OperationStack;
|
||||
|
||||
public:
|
||||
CreateVolumeGroupOperation(const QString& vgname, const QList<Partition*> pvlist);
|
||||
CreateVolumeGroupOperation(const QString& vgname, const QStringList& pvlist);
|
||||
|
||||
public:
|
||||
QString iconName() const override {
|
||||
|
@ -46,7 +46,9 @@ public:
|
|||
|
||||
QString description() const override;
|
||||
|
||||
virtual bool targets(const Device&) const override;
|
||||
virtual bool targets(const Device&) const override {
|
||||
return true;
|
||||
}
|
||||
virtual bool targets(const Partition&) const override;
|
||||
|
||||
virtual void preview() override;
|
||||
|
|
Loading…
Reference in New Issue