python-blivet/SOURCES/0029-add-y-to-lvm.pvcreate.patch

72 lines
2.8 KiB
Diff
Raw Normal View History

2020-04-28 08:55:02 +00:00
From a873679b9440105740e7e34f5a3fc9ce0f2c2ace Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Tue, 28 Aug 2018 09:41:38 +0800
Subject: [PATCH 1/2] add `-y' to lvm.pvcreate
While reinstall a crypt fs, it occasionally failed
[snip]
|gi.overrides.BlockDev.LVMError: Process reported exit code 5:
WARNING: atari signature detected on /dev/mapper/luks-0e5f891c
-7701-48bc-a41e-8d626b6ef953 at offset 466. Wipe it? [y/n]:
[snip]
Add `-y' to lvm.pvcreate
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
blivet/formats/lvmpv.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/blivet/formats/lvmpv.py b/blivet/formats/lvmpv.py
index 260cc0bd..96d25394 100644
--- a/blivet/formats/lvmpv.py
+++ b/blivet/formats/lvmpv.py
@@ -120,9 +120,8 @@ class LVMPhysicalVolume(DeviceFormat):
log_method_call(self, device=self.device,
type=self.type, status=self.status)
- # Consider use of -Z|--zero
- # -f|--force or -y|--yes may be required
- blockdev.lvm.pvcreate(self.device, data_alignment=self.data_alignment)
+ ea_yes = blockdev.ExtraArg.new("-y", "")
+ blockdev.lvm.pvcreate(self.device, data_alignment=self.data_alignment, extra=[ea_yes])
def _destroy(self, **kwargs):
log_method_call(self, device=self.device,
--
2.24.1
From d3d86ec2383bbd8e2797ebaaed551a3fbe8ee437 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 29 Aug 2018 10:05:29 +0200
Subject: [PATCH 2/2] Adjust LVMPhysicalVolumeMethodsTestCase to new pvcreate
option
Adjust tests to changes in f8a7ee3dbd6617eb9a0add96b2c4d124d78a1b98
---
tests/formats_test/methods_test.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/formats_test/methods_test.py b/tests/formats_test/methods_test.py
index 741c4f15..710fa1c5 100644
--- a/tests/formats_test/methods_test.py
+++ b/tests/formats_test/methods_test.py
@@ -389,10 +389,12 @@ class LVMPhysicalVolumeMethodsTestCase(FormatMethodsTestCase):
self.patches["blockdev"].lvm.pvremove.assert_called_with(self.format.device)
def _test_create_backend(self):
+ self.patches["blockdev"].ExtraArg.new.return_value = sentinel.extra_arg
self.format.exists = False
self.format.create()
self.patches["blockdev"].lvm.pvcreate.assert_called_with(self.format.device,
- data_alignment=self.format.data_alignment) # pylint: disable=no-member
+ data_alignment=self.format.data_alignment, # pylint: disable=no-member
+ extra=[sentinel.extra_arg])
class MDRaidMemberMethodsTestCase(FormatMethodsTestCase):
--
2.24.1