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

Vratislav Podzimek vpodzime at redhat.com
Tue May 6 14:20:27 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 | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index 90ea72d..cff1102 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -249,10 +249,14 @@ 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
+                # only one device destroy, so prune preceding resizes and format
+                # creates and migrates and the destroy itself if the device
+                # doesn't exist
                 for _a in prune_actions[:]:
-                    if _a.isResize() or (_a.isFormat() and not _a.isDestroy()):
+                    should_prune = lambda act: act.isResize() or \
+                                   (act.isFormat() and not act.isDestroy()) or \
+                                   (act.isDestroy() and not act.device.exists)
+                    if should_prune(_a):
                         continue
 
                     prune_actions.remove(_a)
-- 
1.9.0



More information about the anaconda-patches mailing list