This patch is still work in progress, but I'd ask you for any comments.
It needs 2 separate patches I've sent last Friday:
- New iswmd parameter for kernel cmdline
- New udev rule for using mdadm for isw_raid_member
and one patch for mdadm 3.0-devel3 which adds export_examine_super_imsm
handler for mdadm -E --export support.
This function should return 3 variables for udev:
MD_LEVEL, MD_UUID, MD_DEVICES.
Activation of preexisting isw raid 1 was tested.
Container and array are displayed in partitioning window.
Array can be used for creating partitions in partitioning window,
but changes can't be written to disk yet.
Other raids array were not tested yet.
diff --git a/storage/devicelibs/mdraid.py b/storage/devicelibs/mdraid.py
index 7d6ace2..5467357 100644
--- a/storage/devicelibs/mdraid.py
+++ b/storage/devicelibs/mdraid.py
@@ -138,6 +138,20 @@ def mdadd(device):
["--incremental",
"--quiet",
"--auto=md",
+ device],
+ stderr = "/dev/tty5",
+ stdout = "/dev/tty5",
+ searchPath=1)
+
+ if rc:
+ raise MDRaidError("mdadd failed for %s" % device)
+
+def mdadd_no_degraded(device):
+ ### FIXME: this should be merged with mdadd function
+ rc = iutil.execWithRedirect("mdadm",
+ ["--incremental",
+ "--auto=md",
+ "--no-degraded",
device],
stderr = "/dev/tty5",
stdout = "/dev/tty5",
diff --git a/storage/devices.py b/storage/devices.py
index 32e4c23..34d31e5 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -2045,9 +2045,13 @@ class MDRaidArrayDevice(StorageDevice):
#self.probe()
if self.exists and self.uuid:
+ if self.level == "container":
+ name = "/dev/md/%s" % self.path.split("/")[2]
+ else:
+ name = self.path
open("/etc/mdadm.conf", "a").write("ARRAY %s UUID=%s\n"
- % (self.path, self.uuid))
-
+ % (name, self.uuid))
+
@property
def size(self):
size = None
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 4a1aeba..f82e290 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -29,7 +29,7 @@ from devices import *
from deviceaction import *
import formats
from udev import *
-
+from flags import flags
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
@@ -990,14 +990,21 @@ class DeviceTree(object):
except (KeyError, IndexError, ValueError) as e:
log.warning("invalid data for %s: %s" % (name, e))
return
-
- device = MDRaidArrayDevice(name,
- level=md_level,
- memberDevices=md_devices,
- uuid=md_uuid,
- exists=True,
- parents=slaves)
- self._addDevice(device)
+ md_array = self.getDeviceByUuid(md_uuid)
+ if md_uuid and md_array:
+ log.debug("--md_uuid=%s already created" % (md_uuid))
+ else:
+ if md_level == "container":
+ # FIXME: it is hardcoded name of container
+ name = "imsm"
+
+ device = MDRaidArrayDevice(name,
+ level=md_level,
+ memberDevices=md_devices,
+ uuid=md_uuid,
+ exists=True,
+ parents=slaves)
+ self._addDevice(device)
elif udev_device_is_cdrom(info):
log.debug("%s is a cdrom" % name)
device = self.getDeviceByName(name)
@@ -1010,6 +1017,15 @@ class DeviceTree(object):
minor=udev_device_get_minor(info),
sysfsPath=sysfs_path)
self._addDevice(device)
+ elif udev_device_is_mdraid(info):
+ log.debug("%s is part of a mdraid" % name)
+ device = self.getDeviceByName(name)
+ if device is None:
+ device = StorageDevice(name,
+ major=udev_device_get_major(info),
+ minor=udev_device_get_minor(info),
+ sysfsPath=sysfs_path, exists=True)
+ self._addDevice(device)
elif udev_device_is_dmraid(info):
# This is just temporary as I need to differentiate between the
# device that has partitions and device that dont.
@@ -1120,9 +1136,18 @@ class DeviceTree(object):
except KeyError:
log.debug("mdraid member %s has no md uuid" % name)
elif format_type == "isw_raid_member":
- # We dont add any new args because we intend to use the same
- # block.RaidSet object for all the related devices.
- pass
+ if flags.cmdline.has_key("iswmd"):
+ # mdadm
+ try:
+ kwargs["mdUuid"] = udev_device_get_md_uuid(info)
+ log.debug("mdUuid=%s" % kwargs["mdUuid"])
+ except KeyError:
+ log.debug("mdraid member %s has no md uuid" % name)
+ else:
+ #dmraid
+ # We dont add any new args because we intend to use the same
+ # block.RaidSet object for all the related devices.
+ pass
elif format_type == "LVM2_member":
# lvm
try:
@@ -1206,27 +1231,38 @@ class DeviceTree(object):
return
# find the first unused minor
- minor = 0
- while True:
- if self.getDeviceByName("md%d" % minor):
- minor += 1
- else:
- break
+ if md_level == "container":
+ minor = 0
+ while True:
+ if self.getDeviceByName("imsm%d" % minor):
+ minor += 1
+ else:
+ break
+ md_name = "imsm%d" % minor
+ else:
+ minor = 0
+ while True:
+ if self.getDeviceByName("md%d" % minor):
+ minor += 1
+ else:
+ break
- md_name = "md%d" % minor
+ md_name = "md%d" % minor
md_array = MDRaidArrayDevice(md_name,
- level=md_level,
- minor=minor,
- memberDevices=md_devices,
- uuid=md_uuid,
- exists=True,
- parents=[device])
- try:
- md_array.setup()
- except (DeviceError, MDRaidError) as e:
- log.info("setup of md array %s failed: %s"
- % (md_array.name, e))
+ level=md_level,
+ minor=minor,
+ memberDevices=md_devices,
+ uuid=md_uuid,
+ exists=True,
+ parents=[device])
self._addDevice(md_array)
+ try:
+ # FIXME: this should be mdraid.mdadd with parameter
+ # no_degraded parameter depends on which member is added
+ # it was tested only for isw raid 1 array with 2 disks
+ mdraid.mdadd_no_degraded(device.path)
+ except MDRaidError as e:
+ log.warning("failed to add member to md array %s" % e)
elif format.type == "dmraidmember":
def _all_ignored(rss):
retval = True
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list