[PATCH 3/4] Make storage.unusedMDFoo also check mdcontainer members

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

 



This becomes important when mixing regular and bios raid mdraid arrays.
---
 storage/__init__.py |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index adb9f81..c127f4a 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -510,6 +510,13 @@ class Storage(object):
         return arrays
 
     @property
+    def mdcontainers(self):
+        """ A list of the MD containers in the device tree. """
+        arrays = self.devicetree.getDevicesByType("mdcontainer")
+        arrays.sort(key=lambda d: d.name)
+        return arrays
+
+    @property
     def mdmembers(self):
         """ A list of the MD member devices in the device tree.
 
@@ -526,7 +533,7 @@ class Storage(object):
         unused = []
         for member in self.mdmembers:
             used = False
-            for _array in self.mdarrays:
+            for _array in self.mdarrays + self.mdcontainers:
                 if _array.dependsOn(member) and _array != array:
                     used = True
                     break
@@ -540,7 +547,7 @@ class Storage(object):
     def unusedMDMinors(self):
         """ Return a list of unused minors for use in RAID. """
         raidMinors = range(0,32)
-        for array in self.mdarrays:
+        for array in self.mdarrays + self.mdcontainers:
             if array.minor is not None:
                 raidMinors.remove(array.minor)
         return raidMinors
@@ -630,7 +637,7 @@ class Storage(object):
             return _("You cannot delete a partition of a LDL formatted "
                      "DASD.")
         elif device.format.type == "mdmember":
-            for array in self.mdarrays:
+            for array in self.mdarrays + self.mdcontainers:
                 if array.dependsOn(device):
                     if array.minor is not None:
                         return _("This device is part of the RAID "
-- 
1.6.5.2

_______________________________________________
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