[PATCH 1/5] Honor zerombr regardless of clearpart setting.

David Lehman dlehman at redhat.com
Tue Sep 23 19:14:13 UTC 2014


Fedora
Resolves: rhbz#1143755
RHEL
Resolves: rhbz#1117946
---
 blivet/__init__.py | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index 22c81a5..611c8d2 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -813,7 +813,10 @@ class Blivet(object):
             self.destroyDevice(device)
 
     def clearPartitions(self):
-        """ Clear partitions and dependent devices from disks. """
+        """ Clear partitions and dependent devices from disks.
+
+            This is also where zerombr is handled.
+        """
         # Sort partitions by descending partition number to minimize confusing
         # things like multiple "destroy sda5" actions due to parted renumbering
         # partitions. This can still happen through the UI but it makes sense to
@@ -834,12 +837,14 @@ class Blivet(object):
 
         # ensure all disks have appropriate disklabels
         for disk in self.disks:
-            if not self.shouldClear(disk):
-                continue
+            zerombr = (self.config.zeroMbr and device.format.type is None)
+            should_clear = self.shouldClear(disk)
+            if should_clear:
+                self.recursiveRemove(disk)
 
-            log.debug("clearpart: initializing %s", disk.name)
-            self.recursiveRemove(disk)
-            self.initializeDisk(disk)
+            if zerombr or should_clear:
+                log.debug("clearpart: initializing %s", disk.name)
+                self.initializeDisk(disk)
 
         self.updateBootLoaderDiskList()
 
-- 
1.9.3



More information about the anaconda-patches mailing list