[PATCH 4/5] Fix detection of preexisting md arrays again.
David Lehman
dlehman at redhat.com
Thu Sep 6 22:02:57 UTC 2012
---
pyanaconda/storage/devices.py | 6 ++++--
pyanaconda/storage/devicetree.py | 7 +++++--
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index a7128ac..0974455 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -2711,7 +2711,7 @@ class MDRaidArrayDevice(StorageDevice):
elif self.level == mdraid.RAID10:
size = (self.memberDevices / 2.0) * smallestMemberSize
size -= size % self.chunkSize
- log.debug("non-existant RAID %s size == %s" % (self.level, size))
+ log.debug("non-existent RAID %s size == %s" % (self.level, size))
else:
size = self.partedDevice.getSize()
log.debug("existing RAID %s size == %s" % (self.level, size))
@@ -2815,7 +2815,9 @@ class MDRaidArrayDevice(StorageDevice):
if not self.exists:
raise DeviceError("device has not been created", self.name)
- if self.status:
+ # We don't use self.status here because self.status requires a valid
+ # sysfs path to function correctly.
+ if os.path.exists(self.path):
md_node = mdraid.md_node_from_name(self.name)
self.sysfsPath = "/devices/virtual/block/%s" % md_node
else:
diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
index 0ab844d..b622a71 100644
--- a/pyanaconda/storage/devicetree.py
+++ b/pyanaconda/storage/devicetree.py
@@ -1024,7 +1024,8 @@ class DeviceTree(object):
#
if device:
# we successfully looked up the device. skip to format handling.
- pass
+ # first, grab the parted.Device while it's active
+ _unused = device.partedDevice
elif udev_device_is_loop(info):
log.info("%s is a loop device" % name)
device = self.addUdevLoopDevice(info)
@@ -1080,6 +1081,7 @@ class DeviceTree(object):
# Don't try to do format handling on drives without media or
# if we didn't end up with a device somehow.
if not device or not device.mediaPresent:
+ log.debug("no device or no media present")
return
# now handle the device's formatting
@@ -1425,12 +1427,12 @@ class DeviceTree(object):
memberDevices=md_devices,
uuid=md_uuid,
metadataVersion=md_metadata,
- sysfsPath=sysfs_path,
exists=True)
except ValueError as e:
log.error("failed to create md array: %s" % e)
return
+ md_array.updateSysfsPath()
md_array._addDevice(device)
self._addDevice(md_array)
@@ -1641,6 +1643,7 @@ class DeviceTree(object):
if self.shouldClear(device):
# if this is a device that will be cleared by clearpart,
# don't bother with format-specific processing
+ log.debug("skipping further processing due to clearpart")
return
#
--
1.7.7.6
More information about the anaconda-patches
mailing list