[PATCH 5/5] Only cancel actions on disks related to the one we are hiding.

David Lehman dlehman at redhat.com
Tue Sep 16 21:01:53 UTC 2014

This includes all actions related to the disk and all actions related
to disks that are linked to the disk being hidden by multi-disk devices
like lvm volume groups.

Related: rhbz#1121383

Related: rhbz#1085201
Related: rhbz#1129595
Related: rhbz#1075671
 blivet/devicetree.py | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 417e39a..0c784a1 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -1905,8 +1905,8 @@ class DeviceTree(object):
             :param device: the device to hide
             :type device: :class:`~.devices.StorageDevice`
-            Hiding a device will cancel all actions and will remove the
-            device from the device list.
+            Hiding a device will cancel all actions that involve the device and
+            will remove the device from the device list.
             If the device is not a leaf device, all devices that depend on it
             will be hidden leaves-first until the device is a leaf device.
@@ -1939,8 +1939,20 @@ class DeviceTree(object):
         # cancel actions first thing so that we hide the correct set of devices
-        for action in reversed(self._actions):
-            self.cancelAction(action)
+        if device.isDisk:
+            # Cancel all actions on this disk and any disk related by way of an
+            # aggregate/container device (eg: lvm volume group).
+            disks = [device]
+            related_actions = [a for a in self._actions
+                                    if a.device.dependsOn(device)]
+            for related_device in (a.device for a in related_actions):
+                disks.extend(related_device.disks)
+            disks = set(disks)
+            cancel = [a for a in self._actions
+                            if set(a.device.disks).intersection(disks)]
+            for action in reversed(cancel):
+                self.cancelAction(action)
         for d in self.getChildren(device):

More information about the anaconda-patches mailing list