partitionmanager: implement check for ZFS

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-11-16 21:12:09 +02:00
parent 978fa4d01f
commit e19f385f59
2 changed files with 11 additions and 1 deletions

View file

@ -48,8 +48,10 @@ namespace FS
void zfs::init()
{
m_SetLabel = findExternal("zpool", QStringList(), 2) ? cmdSupportFileSystem : cmdSupportNone;
m_Check = m_SetLabel;
m_GetUsed = findExternal("zfs", QStringList(), 2) ? cmdSupportFileSystem : cmdSupportNone;
m_GetLabel = cmdSupportCore;
m_Backup = cmdSupportCore;
m_GetUUID = cmdSupportCore;
@ -62,7 +64,7 @@ namespace FS
m_GetLabel != cmdSupportNone &&
m_SetLabel != cmdSupportNone &&
// m_Create != cmdSupportNone &&
// m_Check != cmdSupportNone &&
m_Check != cmdSupportNone &&
// m_UpdateUUID != cmdSupportNone &&
// m_Grow != cmdSupportNone &&
// m_Shrink != cmdSupportNone &&
@ -109,6 +111,13 @@ namespace FS
return result;
}
bool zfs::check(Report& report, const QString& deviceNode) const
{
Q_UNUSED(deviceNode)
ExternalCommand cmd(report, "zpool", QStringList() << "scrub" << "-w" << this->label());
return cmd.run(-1) && (cmd.exitCode() == 0);
}
bool zfs::remove(Report& report, const QString& deviceNode) const
{
Q_UNUSED(deviceNode)

View file

@ -45,6 +45,7 @@ namespace FS
static void init();
virtual qint64 readUsedCapacity(const QString& deviceNode) const;
virtual bool check(Report& report, const QString& deviceNode) const;
virtual bool remove(Report& report, const QString& deviceNode) const;
virtual bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel);