Do not destroy zfs pool when removing zfs partition.

This can be dangerous, e.g. if partition is part of raid set.
So better be more cautious and in some cases fail to remove partition
than lose data.
This commit is contained in:
Andrius Štikonas 2021-10-30 21:13:07 +01:00
parent 6f2be13f68
commit 282cfdcde1
2 changed files with 0 additions and 8 deletions

View File

@ -77,13 +77,6 @@ qint64 zfs::maxCapacity() const
return Capacity::unitFactor(Capacity::Unit::Byte, Capacity::Unit::EiB); return Capacity::unitFactor(Capacity::Unit::Byte, Capacity::Unit::EiB);
} }
bool zfs::remove(Report& report, const QString& deviceNode) const
{
Q_UNUSED(deviceNode)
ExternalCommand cmd(report, QStringLiteral("zpool"), { QStringLiteral("destroy"), QStringLiteral("-f"), label() });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool zfs::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) bool zfs::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
{ {
Q_UNUSED(deviceNode) Q_UNUSED(deviceNode)

View File

@ -35,7 +35,6 @@ public:
public: public:
void init() override; void init() override;
bool remove(Report& report, const QString& deviceNode) const override;
bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) override; bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) override;
CommandSupportType supportGetUsed() const override { CommandSupportType supportGetUsed() const override {