[PATCH] Having 2 raidsets in the same group of devs is possible.

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

 



We were erroneously assuming that there could only exist one RaidSet on
top of a group of underlying devs.  This patch corrects this assumption
by allowing anaconda to see a dynamic number of sets.
---
 storage/devicetree.py |  115 +++++++++++++++++++++++++------------------------
 1 files changed, 58 insertions(+), 57 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index b9552bd..8305e45 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1234,72 +1234,73 @@ class DeviceTree(object):
                 major = udev_device_get_major(info)
                 minor = udev_device_get_minor(info)
                 # Have we already created the DMRaidArrayDevice?
-                rs = block.getRaidSetFromRelatedMem(uuid=uuid, name=name,
+                rss = block.getRaidSetFromRelatedMem(uuid=uuid, name=name,
                                                     major=major, minor=minor)
-                if rs is None:
+                if len(rss) == 0:
                     # we ignore the device in the hope that all the devices
                     # from this set will be ignored.
                     self.addIgnoredDisk(device.name)
                     return
 
-                elif rs.name in self._ignoredDisks:
-                    # If the rs is being ignored, we should ignore device too.
-                    self.addIgnoredDisk(device.name)
-                    return
+                for rs in rss:
+                    if rs.name in self._ignoredDisks:
+                        # If the rs is being ignored, we should ignore device too.
+                        self.addIgnoredDisk(device.name)
+                        return
 
-                else:
-                    dm_array = self.getDeviceByName(rs.name)
-                    if dm_array is not None:
-                        # We add the new device.
-                        dm_array._addDevice(device)
                     else:
-                        # Activate the Raid set.
-                        rs.activate(mknod=True)
-
-                        # Create the DMRaidArray
-                        if self.zeroMbr:
-                            cb = lambda: True
-                        else:
-                            cb = lambda: questionInitializeDisk(self.intf,
-                                                                rs.name)
-
-                        if not self.clearPartDisks or \
-                           rs.name in self.clearPartDisks:
-                            # if the disk contains protected partitions
-                            # we will not wipe the disklabel even if
-                            # clearpart --initlabel was specified
-                            initlabel = self.reinitializeDisks
-                            for protected in self.protectedPartitions:
-                                disk_name = re.sub(r'p\d+$', '', protected)
-                                if disk_name != protected and \
-                                   disk_name == rs.name:
-                                    initlabel = False
-                                    break
+                        dm_array = self.getDeviceByName(rs.name)
+                        if dm_array is not None:
+                            # We add the new device.
+                            dm_array._addDevice(device)
                         else:
-                            initlabel = False
+                            # Activate the Raid set.
+                            rs.activate(mknod=True)
 
-                        try:
-                            dm_array = DMRaidArrayDevice(rs.name,
-                                                    major=major, minor=minor,
-                                                    raidSet=rs,
-                                                    level=rs.level,
-                                                    parents=[device],
-                                                    initcb=cb,
-                                                    initlabel=initlabel)
-
-                            self._addDevice(dm_array)
-                            # Use the rs's object on the device.
-                            # pyblock can return the memebers of a set and the
-                            # device has the attribute to hold it.  But ATM we
-                            # are not really using it. Commenting this out until
-                            # we really need it.
-                            #device.format.raidmem = block.getMemFromRaidSet(dm_array,
-                            #        major=major, minor=minor, uuid=uuid, name=name)
-                        except DeviceUserDeniedFormatError:
-                            # We should ignore the dmriad and its components
-                            self.addIgnoredDisk(rs.name)
-                            self.addIgnoredDisk(device.name)
-                            rs.deactivate()
+                            # Create the DMRaidArray
+                            if self.zeroMbr:
+                                cb = lambda: True
+                            else:
+                                cb = lambda: questionInitializeDisk(self.intf,
+                                                                    rs.name)
+
+                            if not self.clearPartDisks or \
+                               rs.name in self.clearPartDisks:
+                                # if the disk contains protected partitions
+                                # we will not wipe the disklabel even if
+                                # clearpart --initlabel was specified
+                                initlabel = self.reinitializeDisks
+                                for protected in self.protectedPartitions:
+                                    disk_name = re.sub(r'p\d+$', '', protected)
+                                    if disk_name != protected and \
+                                       disk_name == rs.name:
+                                        initlabel = False
+                                        break
+                            else:
+                                initlabel = False
+
+                            try:
+                                dm_array = DMRaidArrayDevice(rs.name,
+                                                        major=major, minor=minor,
+                                                        raidSet=rs,
+                                                        level=rs.level,
+                                                        parents=[device],
+                                                        initcb=cb,
+                                                        initlabel=initlabel)
+
+                                self._addDevice(dm_array)
+                                # Use the rs's object on the device.
+                                # pyblock can return the memebers of a set and the
+                                # device has the attribute to hold it.  But ATM we
+                                # are not really using it. Commenting this out until
+                                # we really need it.
+                                #device.format.raidmem = block.getMemFromRaidSet(dm_array,
+                                #        major=major, minor=minor, uuid=uuid, name=name)
+                            except DeviceUserDeniedFormatError:
+                                # We should ignore the dmriad and its components
+                                self.addIgnoredDisk(rs.name)
+                                self.addIgnoredDisk(device.name)
+                                rs.deactivate()
             elif format.type == "lvmpv":
                 # lookup/create the VG and LVs
                 try:
-- 
1.6.0.6

_______________________________________________
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