Re: [PATCH storage 3/7] 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]

 



Great,

I hit this too today (in a very different way though) and put fixing this
on my todo guess I can remove it now :)

Regards,

Hans


Radek Vykydal wrote:
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 8ba4864..850a220 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -684,13 +684,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)

_______________________________________________
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