Make sure to activate all LVM LVs on start.

This commit is contained in:
Andrius Štikonas 2016-08-14 18:13:13 +01:00
parent eb3910679c
commit 3eda1d79c6
5 changed files with 14 additions and 13 deletions

View File

@ -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)
{
}

View File

@ -23,7 +23,6 @@
#include <QString>
#include <QObject>
#include <QtGlobal>
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();

View File

@ -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;

View File

@ -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;
}

View File

@ -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);