Set VG name as PV mount point
This commit is contained in:
parent
c96682d022
commit
0a6de0c2f0
|
@ -22,6 +22,7 @@
|
||||||
#include "util/capacity.h"
|
#include "util/capacity.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
namespace FS
|
namespace FS
|
||||||
{
|
{
|
||||||
|
@ -117,4 +118,18 @@ bool lvm2_pv::canMount(const QString & deviceNode, const QString & mountPoint) c
|
||||||
Q_UNUSED(mountPoint)
|
Q_UNUSED(mountPoint)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString lvm2_pv::getVGName(const QString& deviceNode) //PV node
|
||||||
|
{
|
||||||
|
ExternalCommand cmd( QStringLiteral("lvm"),
|
||||||
|
{ 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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,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;
|
||||||
|
|
|
@ -36,6 +36,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/externalcommand.h"
|
#include "util/externalcommand.h"
|
||||||
|
@ -252,12 +253,18 @@ Device* LibPartedBackend::scanDevice(const QString& deviceNode)
|
||||||
if (isCryptOpen) {
|
if (isCryptOpen) {
|
||||||
luksFs->loadInnerFileSystem(partitionNode, mapperNode);
|
luksFs->loadInnerFileSystem(partitionNode, mapperNode);
|
||||||
|
|
||||||
mountPoint = mountPoints.findByDevice(mapperNode) ?
|
if (luksFs->type() == FileSystem::Lvm2_PV) {
|
||||||
mountPoints.findByDevice(mapperNode)->mountPoint() :
|
mountPoint = FS::lvm2_pv::getVGName(mapperNode);
|
||||||
QString();
|
mounted = false;
|
||||||
// We cannot use libparted to check the mounted status because
|
} else {
|
||||||
// we don't have a PedPartition for the mapper device, so we use lsblk
|
|
||||||
mounted = isMounted(mapperNode);
|
mountPoint = mountPoints.findByDevice(mapperNode) ?
|
||||||
|
mountPoints.findByDevice(mapperNode)->mountPoint() :
|
||||||
|
QString();
|
||||||
|
// We cannot use libparted to check the mounted status because
|
||||||
|
// we don't have a PedPartition for the mapper device, so we use lsblk
|
||||||
|
mounted = isMounted(mapperNode);
|
||||||
|
}
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint);
|
const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint);
|
||||||
if (freeSpaceInfo.isValid() && mountPoint != QString())
|
if (freeSpaceInfo.isValid() && mountPoint != QString())
|
||||||
|
@ -268,6 +275,10 @@ Device* LibPartedBackend::scanDevice(const QString& deviceNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
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(partitionNode) ?
|
mountPoint = mountPoints.findByDevice(partitionNode) ?
|
||||||
mountPoints.findByDevice(partitionNode)->mountPoint() :
|
mountPoints.findByDevice(partitionNode)->mountPoint() :
|
||||||
|
|
Loading…
Reference in New Issue