Make sure to activate all LVM LVs on start.
This commit is contained in:
parent
eb3910679c
commit
3eda1d79c6
|
@ -26,22 +26,22 @@
|
||||||
|
|
||||||
/** Constructs a Device with an empty PartitionTable.
|
/** Constructs a Device with an empty PartitionTable.
|
||||||
@param name the Device's name, usually some string defined by the manufacturer
|
@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,
|
Device::Device(const QString& name,
|
||||||
const QString& devicenode,
|
const QString& deviceNode,
|
||||||
const qint32 logicalSize,
|
const qint32 logicalSize,
|
||||||
const qint64 totalLogical,
|
const qint64 totalLogical,
|
||||||
const QString& iconname,
|
const QString& iconName,
|
||||||
Device::Type type)
|
Device::Type type)
|
||||||
: QObject()
|
: QObject()
|
||||||
, m_Name(name.length() > 0 ? name : i18n("Unknown Device"))
|
, m_Name(name.length() > 0 ? name : i18n("Unknown Device"))
|
||||||
, m_DeviceNode(devicenode)
|
, m_DeviceNode(deviceNode)
|
||||||
, m_LogicalSize(logicalSize)
|
, m_LogicalSize(logicalSize)
|
||||||
, m_TotalLogical(totalLogical)
|
, m_TotalLogical(totalLogical)
|
||||||
, m_PartitionTable(nullptr)
|
, m_PartitionTable(nullptr)
|
||||||
, m_IconName(iconname.isEmpty() ? QStringLiteral("drive-harddisk") : iconname)
|
, m_IconName(iconName.isEmpty() ? QStringLiteral("drive-harddisk") : iconName)
|
||||||
, m_SmartStatus(type == Device::Disk_Device ? new SmartStatus(devicenode) : nullptr)
|
, m_SmartStatus(type == Device::Disk_Device ? new SmartStatus(deviceNode) : nullptr)
|
||||||
, m_Type(type)
|
, m_Type(type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
class PartitionTable;
|
class PartitionTable;
|
||||||
class CreatePartitionTableOperation;
|
class CreatePartitionTableOperation;
|
||||||
|
@ -55,7 +54,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
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:
|
public:
|
||||||
virtual ~Device();
|
virtual ~Device();
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
void setupConnections();
|
void setupConnections();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void progress(const QString& device_node, int progress);
|
void progress(const QString& deviceNode, int progress);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run() override;
|
void run() override;
|
||||||
|
|
|
@ -112,6 +112,8 @@ Partition* LvmDevice::scanPartition(const QString& lvPath, PartitionTable* pTabl
|
||||||
* without too many special cases.
|
* without too many special cases.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
activateLV(lvPath);
|
||||||
|
|
||||||
qint64 lvSize = getTotalLE(lvPath);
|
qint64 lvSize = getTotalLE(lvPath);
|
||||||
qint64 startSector = mappedSector(lvPath, 0);
|
qint64 startSector = mappedSector(lvPath, 0);
|
||||||
qint64 endSector = startSector + lvSize - 1;
|
qint64 endSector = startSector + lvSize - 1;
|
||||||
|
@ -491,11 +493,11 @@ bool LvmDevice::activateVG(Report& report, const LvmDevice& d)
|
||||||
return deactivate.run(-1) && deactivate.exitCode() == 0;
|
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("lvchange"),
|
||||||
QStringLiteral("--activate"), QStringLiteral("y"),
|
QStringLiteral("--activate"), QStringLiteral("y"),
|
||||||
p.partitionPath() });
|
lvPath });
|
||||||
return deactivate.run(-1) && deactivate.exitCode() == 0;
|
return deactivate.run(-1) && deactivate.exitCode() == 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
static bool createLVSnapshot(Report& report, Partition& p, const QString& name, const qint64 extents = 0);
|
static bool createLVSnapshot(Report& report, Partition& p, const QString& name, const qint64 extents = 0);
|
||||||
static bool resizeLV(Report& report, Partition& p);
|
static bool resizeLV(Report& report, Partition& p);
|
||||||
static bool deactivateLV(Report& report, const 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 removePV(Report& report, LvmDevice& d, const QString& pvPath);
|
||||||
static bool insertPV(Report& report, LvmDevice& d, const QString& pvPath);
|
static bool insertPV(Report& report, LvmDevice& d, const QString& pvPath);
|
||||||
|
|
Loading…
Reference in New Issue