You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
python-blivet/SOURCES/0004-Run-mkfs-xfs-with-forc...

44 lines
1.9 KiB

From 52c9699ecad592e35e0cd3841744f8cb8e2b2364 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 12 Jun 2024 16:51:43 +0200
Subject: [PATCH] Run mkfs.xfs with the force (-f) option by default
We stopped adding the force option when switching to libblockdev
in fa3add214ba8edf1965bc851b85f2f2a6a3ea107. This was not
intentional and the missing force option is already causing issues
when running mkfs.xfs on misaligned devices.
---
blivet/tasks/fsmkfs.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/blivet/tasks/fsmkfs.py b/blivet/tasks/fsmkfs.py
index 096b02295..45314ea89 100644
--- a/blivet/tasks/fsmkfs.py
+++ b/blivet/tasks/fsmkfs.py
@@ -241,6 +241,7 @@ class FSBlockDevMkfs(task.BasicApplication, FSMkfsTask, metaclass=abc.ABCMeta):
can_set_uuid = False
can_label = False
fstype = None
+ force = False
def do_task(self, options=None, label=False, set_uuid=False, nodiscard=False):
"""Create the format on the device and label if possible and desired.
@@ -277,7 +278,8 @@ def do_task(self, options=None, label=False, set_uuid=False, nodiscard=False):
try:
bd_options = BlockDev.FSMkfsOptions(label=self.fs.label if label else None,
uuid=self.fs.uuid if set_uuid else None,
- no_discard=self.fs._mkfs_nodiscard if nodiscard else False)
+ no_discard=self.fs._mkfs_nodiscard if nodiscard else False,
+ force=self.force)
BlockDev.fs.mkfs(self.fs.device, self.fstype, bd_options, extra={k: '' for k in create_options})
except BlockDev.FSError as e:
raise FSError(str(e))
@@ -331,6 +333,7 @@ class XFSMkfs(FSBlockDevMkfs):
can_nodiscard = True
can_set_uuid = True
can_label = True
+ force = True
class F2FSMkfs(FSBlockDevMkfs):