set VG as mount point if the PV belongs to any #2

Closed
Ghost wants to merge 1 commits from (deleted):lvm-support into master
3 changed files with 22 additions and 0 deletions
Showing only changes of commit 1575c350c5 - Show all commits

View File

@ -22,6 +22,7 @@
#include "util/capacity.h" #include "util/capacity.h"
#include <QString> #include <QString>
#include <QRegularExpression>
namespace FS namespace FS
{ {
@ -110,4 +111,18 @@ bool lvm2_pv::updateUUID(Report& report, const QString& deviceNode) const
ExternalCommand cmd(report, QStringLiteral("lvm"), { QStringLiteral("pvchange"), QStringLiteral("--uuid"), deviceNode }); ExternalCommand cmd(report, QStringLiteral("lvm"), { QStringLiteral("pvchange"), QStringLiteral("--uuid"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0; return cmd.run(-1) && cmd.exitCode() == 0;
} }
QString lvm2_pv::getVGName(const QString& deviceNode) //PV node
{
ExternalCommand cmd(QStringLiteral("pvdisplay"),
{ QStringLiteral("--verbose"), deviceNode });
if (cmd.run(-1) && cmd.exitCode() == 0) {
QRegularExpression re(QStringLiteral("VG Name\\h+(\\w+)"));
QRegularExpressionMatch vgName = re.match(cmd.output());
if (vgName.hasMatch())
return vgName.captured(1);
}
return QString();
}
} }

View File

@ -92,6 +92,8 @@ public:
SupportTool supportToolName() const override; SupportTool supportToolName() const override;
bool supportToolFound() const override; bool supportToolFound() const override;
static QString getVGName(const QString& deviceNode);
public: public:
static CommandSupportType m_GetUsed; static CommandSupportType m_GetUsed;
static CommandSupportType m_GetLabel; static CommandSupportType m_GetLabel;

View File

@ -35,6 +35,7 @@
#include "fs/hfs.h" #include "fs/hfs.h"
#include "fs/hfsplus.h" #include "fs/hfsplus.h"
#include "fs/luks.h" #include "fs/luks.h"
#include "fs/lvm2_pv.h"
#include "util/globallog.h" #include "util/globallog.h"
#include "util/helpers.h" #include "util/helpers.h"
@ -385,6 +386,10 @@ void LibPartedBackend::scanDevicePartitions(Device& d, PedDisk* pedDisk)
} }
luksFs->setMounted(mounted); luksFs->setMounted(mounted);
} else if (type == FileSystem::Lvm2_PV) {
//TODO: adding PartitionRole
mountPoint = FS::lvm2_pv::getVGName(node);
mounted = false;
} else { } else {
mountPoint = mountPoints.findByDevice(node) ? mountPoint = mountPoints.findByDevice(node) ?
mountPoints.findByDevice(node)->mountPoint() : mountPoints.findByDevice(node)->mountPoint() :