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

View File

@ -22,6 +22,7 @@
#include "util/capacity.h"
#include <QString>
#include <QRegularExpression>
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 });
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;
bool supportToolFound() const override;
static QString getVGName(const QString& deviceNode);
public:
static CommandSupportType m_GetUsed;
static CommandSupportType m_GetLabel;

View File

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