Mark LVM PV as mounted if it is part of Volume Group.
* Add support for online LVM PV resize and check actions. * Fix support for online actions inside LUKS container.
This commit is contained in:
parent
b539f835b1
commit
e765316f9e
|
@ -143,7 +143,7 @@ bool FileSystem::detectMountStatus(FileSystem* fs, const QString& partitionPath)
|
|||
bool mounted = false;
|
||||
|
||||
if (fs->type() == FileSystem::Lvm2_PV) {
|
||||
mounted = false;
|
||||
mounted = FS::lvm2_pv::getVGName(partitionPath) != QString(); // FIXME: VG name is scanned twice
|
||||
} else {
|
||||
mounted = isMounted(partitionPath);
|
||||
}
|
||||
|
@ -166,8 +166,8 @@ QString FileSystem::readLabel(const QString& deviceNode) const
|
|||
*/
|
||||
bool FileSystem::create(Report& report, const QString& deviceNode)
|
||||
{
|
||||
Q_UNUSED(report);
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(report)
|
||||
Q_UNUSED(deviceNode)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -188,9 +188,9 @@ void FileSystem::scan(const QString& deviceNode)
|
|||
*/
|
||||
bool FileSystem::resize(Report& report, const QString& deviceNode, qint64 newLength) const
|
||||
{
|
||||
Q_UNUSED(report);
|
||||
Q_UNUSED(deviceNode);
|
||||
Q_UNUSED(newLength);
|
||||
Q_UNUSED(report)
|
||||
Q_UNUSED(deviceNode)
|
||||
Q_UNUSED(newLength)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -151,6 +151,9 @@ public:
|
|||
virtual CommandSupportType supportCheck() const {
|
||||
return cmdSupportNone; /**< @return CommandSupportType for checking */
|
||||
}
|
||||
virtual CommandSupportType supportCheckOnline() const {
|
||||
return cmdSupportNone; /**< @return CommandSupportType for checking */
|
||||
}
|
||||
virtual CommandSupportType supportCopy() const {
|
||||
return cmdSupportNone; /**< @return CommandSupportType for copying */
|
||||
}
|
||||
|
|
|
@ -64,6 +64,13 @@ public:
|
|||
return m_innerFs->supportGrow();
|
||||
return cmdSupportNone;
|
||||
}
|
||||
CommandSupportType supportGrowOnline() const override {
|
||||
if (!m_isCryptOpen)
|
||||
return cmdSupportNone;
|
||||
if (m_Grow && m_innerFs)
|
||||
return m_innerFs->supportGrowOnline();
|
||||
return cmdSupportNone;
|
||||
}
|
||||
CommandSupportType supportShrink() const override {
|
||||
if (!m_isCryptOpen)
|
||||
return cmdSupportNone;
|
||||
|
@ -71,6 +78,13 @@ public:
|
|||
return m_innerFs->supportShrink();
|
||||
return cmdSupportNone;
|
||||
}
|
||||
CommandSupportType supportShrinkOnline() const override {
|
||||
if (!m_isCryptOpen)
|
||||
return cmdSupportNone;
|
||||
if (m_Shrink && m_innerFs)
|
||||
return m_innerFs->supportShrinkOnline();
|
||||
return cmdSupportNone;
|
||||
}
|
||||
CommandSupportType supportMove() const override {
|
||||
if (m_isCryptOpen)
|
||||
return cmdSupportNone;
|
||||
|
@ -83,6 +97,13 @@ public:
|
|||
return m_innerFs->supportCheck();
|
||||
return cmdSupportNone;
|
||||
}
|
||||
CommandSupportType supportCheckOnline() const override {
|
||||
if (!m_isCryptOpen)
|
||||
return cmdSupportNone;
|
||||
if (m_Check && m_innerFs)
|
||||
return m_innerFs->supportCheckOnline();
|
||||
return cmdSupportNone;
|
||||
}
|
||||
CommandSupportType supportCopy() const override {
|
||||
if (m_isCryptOpen)
|
||||
return cmdSupportNone;
|
||||
|
|
|
@ -78,14 +78,11 @@ bool lvm2_pv::supportToolFound() const
|
|||
{
|
||||
return
|
||||
m_GetUsed != cmdSupportNone &&
|
||||
// m_GetLabel != cmdSupportNone &&
|
||||
// m_SetLabel != cmdSupportNone &&
|
||||
m_Create != cmdSupportNone &&
|
||||
m_Check != cmdSupportNone &&
|
||||
m_UpdateUUID != cmdSupportNone &&
|
||||
m_Grow != cmdSupportNone &&
|
||||
m_Shrink != cmdSupportNone &&
|
||||
// m_Copy != cmdSupportNone &&
|
||||
m_Move != cmdSupportNone &&
|
||||
m_Backup != cmdSupportNone &&
|
||||
m_GetUUID != cmdSupportNone;
|
||||
|
@ -158,6 +155,12 @@ bool lvm2_pv::resize(Report& report, const QString& deviceNode, qint64 length) c
|
|||
return rval && cmd.run(-1) && cmd.exitCode() == 0;
|
||||
}
|
||||
|
||||
bool lvm2_pv::resizeOnline(Report& report, const QString& deviceNode, const QString& mountPoint, qint64 length) const
|
||||
{
|
||||
Q_UNUSED(mountPoint)
|
||||
return resize(report, deviceNode, length);
|
||||
}
|
||||
|
||||
bool lvm2_pv::updateUUID(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd(report, QStringLiteral("lvm"), { QStringLiteral("pvchange"), QStringLiteral("--uuid"), deviceNode });
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
bool create(Report& report, const QString& deviceNode) override;
|
||||
bool remove(Report& report, const QString& deviceNode) const override;
|
||||
bool resize(Report& report, const QString& deviceNode, qint64 length) const override;
|
||||
bool resizeOnline(Report& report, const QString& deviceNode, const QString& mountPoint, qint64 length) const override;
|
||||
// bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) override;
|
||||
bool updateUUID(Report& report, const QString& deviceNode) const override;
|
||||
QString readUUID(const QString& deviceNode) const override;
|
||||
|
@ -76,15 +77,24 @@ public:
|
|||
CommandSupportType supportGrow() const override {
|
||||
return m_Grow;
|
||||
}
|
||||
CommandSupportType supportGrowOnline() const override {
|
||||
return m_Grow;
|
||||
}
|
||||
CommandSupportType supportShrink() const override {
|
||||
return m_Shrink;
|
||||
}
|
||||
CommandSupportType supportShrinkOnline() const override {
|
||||
return m_Shrink;
|
||||
}
|
||||
CommandSupportType supportMove() const override {
|
||||
return m_Move;
|
||||
}
|
||||
CommandSupportType supportCheck() const override {
|
||||
return m_Check;
|
||||
}
|
||||
CommandSupportType supportCheckOnline() const override {
|
||||
return m_Check;
|
||||
}
|
||||
CommandSupportType supportCopy() const override {
|
||||
return m_Copy;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ bool CheckOperation::canCheck(const Partition* p)
|
|||
return false;
|
||||
|
||||
if (p->isMounted())
|
||||
return false;
|
||||
return p->fileSystem().supportCheckOnline() != FileSystem::cmdSupportNone;
|
||||
|
||||
return p->fileSystem().supportCheck() != FileSystem::cmdSupportNone;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include "jobs/resizefilesystemjob.h"
|
||||
#include "jobs/movefilesystemjob.h"
|
||||
|
||||
#include "ops/checkoperation.h"
|
||||
|
||||
#include "fs/filesystem.h"
|
||||
|
||||
#include "util/capacity.h"
|
||||
|
@ -63,7 +65,7 @@ ResizeOperation::ResizeOperation(Device& d, Partition& p, qint64 newfirst, qint6
|
|||
m_GrowSetGeomJob(nullptr),
|
||||
m_CheckResizedJob(nullptr)
|
||||
{
|
||||
if(!partition().isMounted()) // FIXME: add support for checkOnline for file systems that support it.
|
||||
if(CheckOperation::canCheck(&partition()))
|
||||
addJob(checkOriginalJob());
|
||||
|
||||
if (partition().roles().has(PartitionRole::Extended)) {
|
||||
|
@ -100,7 +102,7 @@ ResizeOperation::ResizeOperation(Device& d, Partition& p, qint64 newfirst, qint6
|
|||
|
||||
m_CheckResizedJob = new CheckFileSystemJob(partition());
|
||||
|
||||
if(!partition().isMounted()) // FIXME: add support for checkOnline for file systems that support it.
|
||||
if(CheckOperation::canCheck(&partition()))
|
||||
addJob(checkResizedJob());
|
||||
}
|
||||
}
|
||||
|
@ -143,13 +145,11 @@ void ResizeOperation::undo()
|
|||
|
||||
bool ResizeOperation::execute(Report& parent)
|
||||
{
|
||||
bool rval = false;
|
||||
bool rval = true;
|
||||
|
||||
Report* report = parent.newChild(description());
|
||||
|
||||
if (partition().isMounted()) // FIXME: add support for checkOnline for file systems that support it.
|
||||
rval = true;
|
||||
else
|
||||
if (CheckOperation::canCheck(&partition()))
|
||||
rval = checkOriginalJob()->run(*report);
|
||||
|
||||
if (rval) {
|
||||
|
@ -165,13 +165,11 @@ bool ResizeOperation::execute(Report& parent)
|
|||
rval = shrink(*report) && move(*report) && grow(*report);
|
||||
|
||||
if (rval) {
|
||||
if (partition().isMounted()) // FIXME: add support for checkOnline for file systems that support it.
|
||||
rval = true;
|
||||
else
|
||||
if (CheckOperation::canCheck(&partition())) {
|
||||
rval = checkResizedJob()->run(*report);
|
||||
|
||||
if (!rval)
|
||||
report->line() << xi18nc("@info:status", "Checking partition <filename>%1</filename> after resize/move failed.", partition().deviceNode());
|
||||
if (!rval)
|
||||
report->line() << xi18nc("@info:status", "Checking partition <filename>%1</filename> after resize/move failed.", partition().deviceNode());
|
||||
}
|
||||
} else
|
||||
report->line() << xi18nc("@info:status", "Resizing/moving partition <filename>%1</filename> failed.", partition().deviceNode());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue