neil / rpms / python-blivet

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