python-blivet/0004-Run-mkfs-xfs-with-force-option-by-default.patch
Vojtech Trefny f209b60b06 RHEL 10.0 Beta fixes
- tests: Try waiting after partition creation for XFS resize test
  Resolves: RHEL-45177
- Run mkfs.xfs with the force (-f) option by default
  Resolves: RHEL-39384
2024-06-28 10:31:51 +02:00

44 lines
1.9 KiB
Diff

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):