Initial work on storing LVM variables during initial scan.
This commit is contained in:
parent
ec05aa36da
commit
5e5178b3af
|
@ -198,7 +198,7 @@ Partition* LvmDevice::scanPartition(const QString& lvPath, PartitionTable* pTabl
|
|||
|
||||
/** scan and contruct list of initialized LvmDevice objects.
|
||||
*
|
||||
* @return list of initialized LvmDevice
|
||||
* @return list of initialized LvmDevices
|
||||
*/
|
||||
QList<LvmDevice*> LvmDevice::scanSystemLVM()
|
||||
{
|
||||
|
|
|
@ -329,6 +329,7 @@ void luks::loadInnerFileSystem(const QString& mapperNode)
|
|||
setUUID(m_innerFs->readUUID(mapperNode));
|
||||
if (m_innerFs->supportGetUsed() == FileSystem::cmdSupportFileSystem)
|
||||
setSectorsUsed((m_innerFs->readUsedCapacity(mapperNode) + payloadOffset()) / m_logicalSectorSize );
|
||||
m_innerFs->scan(mapperNode);
|
||||
}
|
||||
|
||||
void luks::createInnerFileSystem(FileSystem::Type type)
|
||||
|
|
|
@ -158,6 +158,8 @@ public:
|
|||
void getKeySize(const QString& deviceNode);
|
||||
void getPayloadOffset(const QString& deviceNode);
|
||||
|
||||
FileSystem* innerFS() const { return m_innerFs; }; // avoid calling this unless necessary
|
||||
|
||||
QString mapperName() const { return m_MapperName; };
|
||||
QString cipherName() const { return m_CipherName; };
|
||||
QString cipherMode() const { return m_CipherMode; };
|
||||
|
|
|
@ -66,6 +66,11 @@ void lvm2_pv::init()
|
|||
m_Copy = cmdSupportNone; // Copying PV can confuse LVM
|
||||
}
|
||||
|
||||
void lvm2_pv::scan(const QString& deviceNode)
|
||||
{
|
||||
getPESize(deviceNode);
|
||||
}
|
||||
|
||||
bool lvm2_pv::supportToolFound() const
|
||||
{
|
||||
return
|
||||
|
@ -127,7 +132,7 @@ bool lvm2_pv::resize(Report& report, const QString& deviceNode, qint64 length) c
|
|||
|
||||
qint64 lastPE = getTotalPE(deviceNode) - 1; // starts from 0
|
||||
if (lastPE > 0) { // make sure that the PV is already in a VG
|
||||
qint64 targetPE = (length - metadataOffset) / getPESize(deviceNode) - 1; // starts from 0
|
||||
qint64 targetPE = (length - metadataOffset) / peSize() - 1; // starts from 0
|
||||
if (targetPE < lastPE) { //shrinking FS
|
||||
qint64 firstMovedPE = qMax(targetPE + 1, getAllocatedPE(deviceNode)); // starts from 1
|
||||
ExternalCommand moveCmd(report,
|
||||
|
@ -275,10 +280,10 @@ qint64 lvm2_pv::getPVSize(const QStringList& deviceNodeList)
|
|||
return sum;
|
||||
}
|
||||
|
||||
qint64 lvm2_pv::getPESize(const QString& deviceNode) const
|
||||
void lvm2_pv::getPESize(const QString& deviceNode)
|
||||
{
|
||||
QString val = getpvField(QStringLiteral("vg_extent_size"), deviceNode);
|
||||
return val.isEmpty() ? -1 : val.toLongLong();
|
||||
m_PESize = val.isEmpty() ? -1 : val.toLongLong();
|
||||
}
|
||||
|
||||
/** Get pvs command output with field name
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
|
||||
public:
|
||||
void init() override;
|
||||
void scan(const QString& deviceNode) override;
|
||||
|
||||
qint64 readUsedCapacity(const QString& deviceNode) const override;
|
||||
bool check(Report& report, const QString& deviceNode) const override;
|
||||
|
@ -100,22 +101,22 @@ public:
|
|||
SupportTool supportToolName() const override;
|
||||
bool supportToolFound() const override;
|
||||
|
||||
static QString getpvField(const QString& fieldName, const QString& deviceNode = QString());
|
||||
|
||||
static qint64 getTotalPE(const QString& deviceNode);
|
||||
static qint64 getTotalPE(const QStringList& deviceNodeList);
|
||||
static qint64 getFreePE(const QString& deviceNode);
|
||||
static qint64 getFreePE(const QStringList& deviceNodeList);
|
||||
static qint64 getAllocatedPE(const QString& deviceNode);
|
||||
static qint64 getAllocatedPE(const QStringList& deviceNodeList);
|
||||
qint64 getPESize(const QString& deviceNode) const; // return PE size in bytes
|
||||
void getPESize(const QString& deviceNode); // return PE size in bytes
|
||||
static qint64 getPVSize(const QString& deviceNode); // return PV size in bytes
|
||||
static qint64 getPVSize(const QStringList& deviceNodeList);
|
||||
|
||||
static QString getVGName(const QString& deviceNode);
|
||||
static QStringList getFreePV();
|
||||
static bool isUsed(const QString& pvNode);
|
||||
|
||||
static QString getVGName(const QString& deviceNode);
|
||||
static QString getpvField(const QString& fieldName, const QString& deviceNode = QString());
|
||||
|
||||
static QStringList getFreePV();
|
||||
qint64 peSize() const { return m_PESize; };
|
||||
|
||||
public:
|
||||
static CommandSupportType m_GetUsed;
|
||||
|
@ -131,6 +132,9 @@ public:
|
|||
static CommandSupportType m_UpdateUUID;
|
||||
static CommandSupportType m_GetUUID;
|
||||
|
||||
private:
|
||||
qint64 m_PESize;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue