Looks ok, Regards, Hans On 04/21/2009 01:17 AM, David Lehman wrote:
--- storage/devicelibs/mdraid.py | 57 +++++++++++------------------------------ storage/devices.py | 8 ------ 2 files changed, 16 insertions(+), 49 deletions(-) diff --git a/storage/devicelibs/mdraid.py b/storage/devicelibs/mdraid.py index 333fa6c..7b8bf23 100644 --- a/storage/devicelibs/mdraid.py +++ b/storage/devicelibs/mdraid.py @@ -199,49 +199,24 @@ def mddeactivate(device): raise MDRaidError("mddeactivate failed for %s" % device) def mdexamine(device): - # XXX NOTUSED: we grab metadata from udev, which ran 'mdadm -E --export' - # - # FIXME: this will not work with version>= 1 metadata - # - # We should use mdadm -Eb or mdadm -E --export for a more easily - # parsed output format. - lines = iutil.execWithCapture("mdadm", - ["--examine", device], - stderr="/dev/tty5").splitlines() - - info = { - 'major': "-1", - 'minor': "-1", - 'uuid' : "", - 'level': -1, - 'nrDisks': -1, - 'totalDisks': -1, - 'mdMinor': -1, - } - - for line in lines: - (key, sep, val) = line.strip().partition(" : ") - if not sep: - continue - if key == "Version": - (major, sep, minor) = val.partition(".") - info['major'] = major - info['minor'] = minor - elif key == "UUID": - info['uuid'] = val.split()[0] - elif key == "Raid Level": - info['level'] = int(val[4:]) - elif key == "Raid Devices": - info['nrDisks'] = int(val) - elif key == "Total Devices": - info['totalDisks'] = int(val) - elif key == "Preferred Minor": - info['mdMinor'] = int(val) - else: + vars = iutil.execWithCapture("mdadm", + ["--examine", "--brief", device], + stderr="/dev/tty5").split() + + info = {} + if vars: + try: + info["device"] = vars[1] + vars = vars[2:] + except IndexError: + return {} + + for var in vars: + (name, equals, value) = var.partition("=") + if not equals: continue - if not info['uuid']: - raise MDRaidError("UUID missing from device info") + info[name.lower()] = value.strip() return info diff --git a/storage/devices.py b/storage/devices.py index 976c238..ea26e8b 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -2234,14 +2234,6 @@ class MDRaidArrayDevice(StorageDevice): info = mdraid.mdexamine(self.devices[0].path) if self.level is None: self.level = mdraid.raidLevel(info['level']) - if self.memberDevices is None: - self.memberDevices = info['nrDisks'] - if self.totalDevices is None: - self.totalDevices = info['totalDisks'] - if self.uuid is None: - self.uuid = info['uuid'] - if self.minor is None: - self.minor = info['mdMinor'] @property def fstabSpec(self):
_______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list