[PATCH storage] Fix removing of devices with the same name from tree when adding create action.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bug met when reediting new raid array in UI. When we register
create device action, we want to remove (beside the created device)
also devices with the same name from the tree, which needs the fix.
---
 storage/devicetree.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index fb33eff..b7ab4bb 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -679,13 +679,15 @@ class DeviceTree(object):
             (action.isCreate() and action.isFormat())) and \
            action.device not in self._devices:
             raise DeviceTreeError("device is not in the tree")
-        elif (action.isCreate() and action.isDevice()) and \
-             (action.device in self._devices or \
-              action.device.path in [d.path for d in self._devices]):
+        elif (action.isCreate() and action.isDevice()):
             # this allows multiple create actions w/o destroy in between;
             # we will clean it up before processing actions
             #raise DeviceTreeError("device is already in the tree")
-            self._removeDevice(action.device)
+            if action.device in self._devices:
+                self._removeDevice(action.device)
+            for d in self._devices:
+                if d.path == action.device.path:
+                    self._removeDevice(d)
 
         if action.isCreate() and action.isDevice():
             self._addDevice(action.device)
-- 
1.5.4.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux