From 3eda1d79c6edb80151157d5c49c3fa2c6ff3550a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 14 Aug 2016 18:13:13 +0100 Subject: [PATCH] Make sure to activate all LVM LVs on start. --- src/core/device.cpp | 12 ++++++------ src/core/device.h | 3 +-- src/core/devicescanner.h | 2 +- src/core/lvmdevice.cpp | 8 +++++--- src/core/lvmdevice.h | 2 +- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/core/device.cpp b/src/core/device.cpp index 157a0dd..7b4904e 100644 --- a/src/core/device.cpp +++ b/src/core/device.cpp @@ -26,22 +26,22 @@ /** Constructs a Device with an empty PartitionTable. @param name the Device's name, usually some string defined by the manufacturer - @param devicenode the Device's node, for example "/dev/sda" + @param deviceNode the Device's node, for example "/dev/sda" */ Device::Device(const QString& name, - const QString& devicenode, + const QString& deviceNode, const qint32 logicalSize, const qint64 totalLogical, - const QString& iconname, + const QString& iconName, Device::Type type) : QObject() , m_Name(name.length() > 0 ? name : i18n("Unknown Device")) - , m_DeviceNode(devicenode) + , m_DeviceNode(deviceNode) , m_LogicalSize(logicalSize) , m_TotalLogical(totalLogical) , m_PartitionTable(nullptr) - , m_IconName(iconname.isEmpty() ? QStringLiteral("drive-harddisk") : iconname) - , m_SmartStatus(type == Device::Disk_Device ? new SmartStatus(devicenode) : nullptr) + , m_IconName(iconName.isEmpty() ? QStringLiteral("drive-harddisk") : iconName) + , m_SmartStatus(type == Device::Disk_Device ? new SmartStatus(deviceNode) : nullptr) , m_Type(type) { } diff --git a/src/core/device.h b/src/core/device.h index f8f4eb8..4583891 100644 --- a/src/core/device.h +++ b/src/core/device.h @@ -23,7 +23,6 @@ #include #include -#include class PartitionTable; class CreatePartitionTableOperation; @@ -55,7 +54,7 @@ public: }; protected: - Device(const QString& name, const QString& devicenode, const qint32 logicalSize, const qint64 totalLogical, const QString& iconname = QString(), Device::Type type = Device::Disk_Device); + Device(const QString& name, const QString& deviceNode, const qint32 logicalSize, const qint64 totalLogical, const QString& iconName = QString(), Device::Type type = Device::Disk_Device); public: virtual ~Device(); diff --git a/src/core/devicescanner.h b/src/core/devicescanner.h index 741c406..0eb00e3 100644 --- a/src/core/devicescanner.h +++ b/src/core/devicescanner.h @@ -43,7 +43,7 @@ public: void setupConnections(); Q_SIGNALS: - void progress(const QString& device_node, int progress); + void progress(const QString& deviceNode, int progress); protected: void run() override; diff --git a/src/core/lvmdevice.cpp b/src/core/lvmdevice.cpp index d357922..3b25398 100644 --- a/src/core/lvmdevice.cpp +++ b/src/core/lvmdevice.cpp @@ -112,6 +112,8 @@ Partition* LvmDevice::scanPartition(const QString& lvPath, PartitionTable* pTabl * without too many special cases. */ + activateLV(lvPath); + qint64 lvSize = getTotalLE(lvPath); qint64 startSector = mappedSector(lvPath, 0); qint64 endSector = startSector + lvSize - 1; @@ -491,11 +493,11 @@ bool LvmDevice::activateVG(Report& report, const LvmDevice& d) return deactivate.run(-1) && deactivate.exitCode() == 0; } -bool LvmDevice::activateLV(Report& report, Partition& p) +bool LvmDevice::activateLV(const QString& lvPath) { - ExternalCommand deactivate(report, QStringLiteral("lvm"), + ExternalCommand deactivate(QStringLiteral("lvm"), { QStringLiteral("lvchange"), QStringLiteral("--activate"), QStringLiteral("y"), - p.partitionPath() }); + lvPath }); return deactivate.run(-1) && deactivate.exitCode() == 0; } diff --git a/src/core/lvmdevice.h b/src/core/lvmdevice.h index 993e25f..006fc29 100644 --- a/src/core/lvmdevice.h +++ b/src/core/lvmdevice.h @@ -79,7 +79,7 @@ public: static bool createLVSnapshot(Report& report, Partition& p, const QString& name, const qint64 extents = 0); static bool resizeLV(Report& report, Partition& p); static bool deactivateLV(Report& report, const Partition& p); - static bool activateLV(Report& report, Partition& p); + static bool activateLV(const QString& deviceNode); static bool removePV(Report& report, LvmDevice& d, const QString& pvPath); static bool insertPV(Report& report, LvmDevice& d, const QString& pvPath);