Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   ArchLinux Development (http://www.linux-archive.org/archlinux-development/)
-   -   Make storage.unusedMDFoo also check mdcontainer members (http://www.linux-archive.org/archlinux-development/314217-make-storage-unusedmdfoo-also-check-mdcontainer-members.html)

Hans de Goede 01-24-2010 09:37 AM

Make storage.unusedMDFoo also check mdcontainer members
 
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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 04:08 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.