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

[PATCH 3/4] Reverse: "Support for MD containers"



Reverse most of commit 9e4d2e76713c9c71dcdaf22767211c13be9b3668, because it
currently is not working and MD containers can for 99.9 % be treated as
regular mdarrays. The next patch from this set instead makes the necessary
changes to use the regular mdarray handling code, reducing the amount
of code.
---
 storage/devices.py    |   31 ---------------------
 storage/devicetree.py |   70 -------------------------------------------------
 storage/udev.py       |    4 ---
 3 files changed, 0 insertions(+), 105 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 40501d7..8034f1e 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -2564,37 +2564,6 @@ class MDRaidArrayDevice(StorageDevice):
         # real work, but it isn't our place to do it from here.
         self.exists = False
 
-class MDRaidContainerDevice(MDRaidArrayDevice):
-    """ An mdraid container device.
-    """
-    _type = "mdcontainer"
-    _devDir = "/dev/md"
-
-    def __init__(self, name, 
-                 memberDevices=None, 
-                 uuid=None, exists=None,
-                 parents=None):
-        """ Create a MDRaidContainerDevice instance.
-
-            Arguments:
-
-                name -- the device name (generally a device node's basename)
-
-            Keyword Arguments:
-
-                parents -- list of member devices (StorageDevice instances)
-                uuid -- the device's UUID
-                exists -- indicates whether this is an existing device
-        """
-        MDRaidArrayDevice.__init__(self, name, 
-                                  memberDevices=memberDevices,
-                                  uuid=uuid, exists=exists, parents=parents)
-
-    def addFirstDevice(self, path):
-        mdraid.mdadd(path, True)
-        udev_settle(timeout=10)
-        real=os.readlink(self.path).split('/')[1]
-        self.sysfsPath = "/devices/virtual/block/%s" % real
 
 class DMRaidArrayDevice(DiskDevice):
     """ A dmraid (device-mapper RAID) device """
diff --git a/storage/devicetree.py b/storage/devicetree.py
index d91fcba..6a1ad61 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -978,68 +978,6 @@ class DeviceTree(object):
 
         return device
 
-
-    def addUdevMDContainerDevice(self, info):
-        log.debug("info=%s" % info)
-        if info.has_key("MD_DEVNAME"):
-            log.debug("real MD container")
-        else:
-            log.debug("isw md member")
-            name = udev_device_get_name(info)
-            sysfs_path = udev_device_get_sysfs_path(info)
-            
-            device = StorageDevice(name,
-                            major=udev_device_get_major(info),
-                            minor=udev_device_get_minor(info),
-                            sysfsPath=sysfs_path, exists=True)
-            self._addDevice(device)
-
-            format_type = udev_device_get_format(info)
-            args = [format_type]
-            kwargs = {"mdUuid": udev_device_get_md_uuid(info),
-                      "uuid": udev_device_get_uuid(info),
-                  "label": udev_device_get_label(info),
-                  "device": device.path,
-                  "exists": True}
-
-            log.debug("uuid=%s" % kwargs["uuid"])
-            log.debug("mdUuid=%s" % kwargs["mdUuid"])
-            device.format = formats.getFormat(*args, **kwargs)
-            log.debug("format=%s mdUuid=%s" % (device.format, device.format.mdUuid))
-            
-            if device.format.mdUuid:
-                md_array = self.getDeviceByUuid(device.format.mdUuid)
-                if md_array:
-                    log.debug("_addDevice to array")
-                    md_array._addDevice(device)
-                else:
-                    try:
-                        md_level = udev_device_get_md_level(info)
-                        md_devices = int(udev_device_get_md_devices(info))
-                        md_uuid = udev_device_get_md_uuid(info)
-                    except (KeyError, ValueError) as e:
-                        log.warning("invalid data for %s: %s" % (name, e))
-                        return
-         
-                    minor = 0
-                    while True:
-                          if self.getDeviceByName("imsm%d" % minor):
-                                minor += 1
-                          else:
-                                break
-                    md_name = "imsm%d" % minor
-                    md_array = MDRaidContainerDevice(name=md_name,
-                                                 memberDevices=md_devices,
-                                                 uuid=md_uuid,
-                                                 exists=True,
-                                                 parents=[device])
-                    try: 
-                        md_array.addFirstDevice(device.path)
-                        self._addDevice(md_array)
-                        return 
-                    except MDRaidError as e:
-                          log.warning("failed to add member to md array %s" % e)
-
     def addUdevMDDevice(self, info):
         name = udev_device_get_name(info)
         log_method_call(self, name=name)
@@ -1239,14 +1177,6 @@ class DeviceTree(object):
 
             if device is None:
                 device = self.addUdevDMDevice(info)
-        elif udev_device_is_md_container(info):
-            log.debug("%s is an md container device" % name)
-            if device is None and uuid:
-                # try to find the device by uuid
-                device = self.getDeviceByUuid(uuid)
-
-            if device is None:
-                device = self.addUdevMDContainerDevice(info)
         elif udev_device_is_md(info):
             log.debug("%s is an md device" % name)
             if device is None and uuid:
diff --git a/storage/udev.py b/storage/udev.py
index aa2f7d9..7571baf 100644
--- a/storage/udev.py
+++ b/storage/udev.py
@@ -218,10 +218,6 @@ def udev_device_is_dm(info):
     """ Return True if the device is a device-mapper device. """
     return info.has_key("DM_NAME")
 
-def udev_device_is_md_container(info):
-    """ Return True if the device is a mdraid container device. """
-    return info.get("MD_LEVEL") == "container"
-
 def udev_device_is_md(info):
     """ Return True if the device is a mdraid array device. """
     return info.has_key("MD_DEVNAME") and \
-- 
1.6.2.2


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