[master 2/2] Allow adding new partitions to disks with active devices (#1212841)

vojtechtrefny installerbot-noreply at redhat.com
Fri Apr 24 12:55:30 UTC 2015


From: Vojtech Trefny <vtrefny at redhat.com>

Parted doesn't allow changing disklabel when there is an active
partition on the disk. Current implementation of
findActiveDevicesOnActionDisks doesn't allow adding new partitions
when there is an existing active (child) device other than another
partition (eg. VG). New version checks only actions that actually
changes the disklabel and checks status of formats of (child) devices
on the disk with changes.

Signed-off-by: Vojtech Trefny <vtrefny at redhat.com>
---
 blivet/actionlist.py | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/blivet/actionlist.py b/blivet/actionlist.py
index be182c8..8613f44 100644
--- a/blivet/actionlist.py
+++ b/blivet/actionlist.py
@@ -247,18 +247,21 @@ def _findActiveDevicesOnActionDisks(self, devices=None):
         disks = []
         for action in self._actions:
             disk = None
-            if action.isDevice and isinstance(action.device, PartitionDevice):
-                disk = action.device.disk
-            elif action.isFormat and action.format.type == "disklabel":
+            if action.isFormat and action.format.type == "disklabel":
                 disk = action.device
 
             if disk is not None and disk not in disks:
                 disks.append(disk)
 
-        active = (dev for dev in devices
-                        if (dev.status and
-                            (not dev.isDisk and
-                             not isinstance(dev, PartitionDevice))))
+        active = []
+        for dev in devices:
+            if dev.status and not dev.isDisk and \
+               not isinstance(dev, PartitionDevice):
+                active.append(dev)
+
+            if dev.format.status and not dev.isDisk:
+                active.append(dev)
+
         devices = [a.name for a in active if any(d in disks for d in a.disks)]
         return devices
 


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/a86b1659f98da1093dcd66c268ee60a5889ace57


More information about the anaconda-patches mailing list