[PATCH 2/2 v2] Remove actions that try to remove non-existing devices (#906807)

Vratislav Podzimek vpodzime at redhat.com
Wed May 7 07:45:15 UTC 2014


When clicking in the partitioning GUI it may happen that an action trying
to destroy a device that doesn't exist in the list ends up in the list of the
actions to be processed. Those cases are bugs and it should never happen, but
instead of doing changes in partitioning code we can simply remove such invalid
actions in the pruneActions() method.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 storage/devicetree.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index 90ea72d..6ec5c7f 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -249,13 +249,16 @@ class DeviceTree(object):
 
             prune_actions = self.findActions(devid=a.device.id)
             if start is None:
-                # only one device destroy, so prune preceding resizes and
-                # format creates and migrates
-                for _a in prune_actions[:]:
-                    if _a.isResize() or (_a.isFormat() and not _a.isDestroy()):
+                # only one device destroy, so prune preceding resizes and format
+                # creates and migrates and the destroy itself if the device
+                # doesn't exist
+                for act in prune_actions[:]:
+                    if act.isResize() or \
+                       (act.isFormat() and not act.isDestroy()) or \
+                       (act.isDestroy() and not act.device.exists):
                         continue
 
-                    prune_actions.remove(_a)
+                    prune_actions.remove(act)
 
                 if not prune_actions:
                     # nothing to prune
-- 
1.9.0



More information about the anaconda-patches mailing list