[PATCH 3/6] Activate md member

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

 



This patch add activation of MD container and add disk to the container.

To make this possible name of devDir was changes to /dev/md. Name of container is created as imsm[number]. Container path can be for example /dev/md/imsm0

Name of the native format array is changed from md[number] to [number] only.
Array path can be for example /dev/md/0

Function mdraid.mdadd_no_degraded is use only for adding first member to the array.
It is needed for isw format. For the next disks function md_array._addDevice is used in
other path.
commit 8a45d537a1f154522de27052a36636bb55e692b0
Author: Jacek Danecki <Jacek.Danecki@xxxxxxxxx>
Date:   Fri Apr 10 13:45:36 2009 -0400

    activate mdmember

diff --git a/storage/devices.py b/storage/devices.py
index 0d39d12..b801688 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -2031,6 +2031,7 @@ class MDRaidArrayDevice(StorageDevice):
         can be used to represent a partitionable device.
     """
     _type = "mdarray"
+    _devDir = "/dev/md"
 
     def __init__(self, name, level=None, minor=None, size=None,
                  memberDevices=None, totalDevices=None, bitmap=False,
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 3f2ec18..6247042 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -945,6 +945,12 @@ class DeviceTree(object):
 
         return device
 
+    def md_is_container(self, md_level):
+            if md_level == "container":
+                return True
+            else:
+                return False       
+ 
     def addUdevMDDevice(self, info):
         name = udev_device_get_name(info)
         log_method_call(self, name=name)
@@ -1296,13 +1302,17 @@ class DeviceTree(object):
 
             # find the first unused minor
             minor = 0
+            
+            if self.md_is_container(md_level):
+                base = "imsm"
+            else:
+                base = ""
             while True:
-                if self.getDeviceByName("md%d" % minor):
-                    minor += 1
-                else:
-                    break
-
-            md_name = "md%d" % minor
+                  if self.getDeviceByName("%s%d" % (base, minor)):
+                        minor += 1
+                  else:
+                        break
+            md_name = "%s%d" % (base, minor)
             md_array = MDRaidArrayDevice(md_name,
                                          level=md_level,
                                          minor=minor,
@@ -1311,12 +1321,11 @@ class DeviceTree(object):
                                          sysfsPath=sysfs_path,
                                          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))
             self._addDevice(md_array)
+            try: 
+                 mdraid.mdadd_no_degraded(device.path)
+            except MDRaidError as e:
+                  log.warning("failed to add member to md array %s" % e)
 
     def handleUdevDMRaidMemberFormat(self, info, device):
         log_method_call(self, name=device.name, type=device.format.type)
_______________________________________________
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