Re: [PATCH 2/4] Hide biosraid member devices that contain MDRaidMember formats.

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

 



Hi,

On 12/16/2009 06:01 PM, David Lehman wrote:
This brings the behavior in line with other (dmraid) biosraid members.
---
  storage/devicetree.py     |    7 ++++++-
  storage/formats/mdraid.py |    5 +++++
  2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index 1a981f2..ff8c168 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1569,6 +1569,10 @@ class DeviceTree(object):
          name = udev_device_get_name(info)
          sysfs_path = udev_device_get_sysfs_path(info)

+        if udev_device_is_biosraid(info):
+            # this will prevent display of the member devices in the UI
+            device.format.biosraid = True
+
          md_array = self.getDeviceByUuid(device.format.mdUuid)
          if device.format.mdUuid and md_array:
              md_array._addDevice(device)
@@ -1710,7 +1714,8 @@ class DeviceTree(object):
          # Now, if the device is a disk, see if there is a usable disklabel.
          # If not, see if the user would like to create one.
          format = getFormat(format_type)
-        if device.partitionable and not format.hidden:
+        if device.partitionable and not \
+           (format.hidden or udev_device_is_biosraid(info)):
              self.handleUdevDiskLabelFormat(info, device)
              if device.partitioned or self.isIgnored(info):
                  # If the device has a disklabel, or the user chose not to

This hunk seems a bit double, given that you already override hidden to
take the biosraid format attribute into account. I know this has
not been set yet, but still this does not feel right. I must admit
I cannot come up with a decent other way to do this, but still this seems
wrong.

I think it might be better to instead do:
         # Now, if the device is a disk, see if there is a usable disklabel.
         # If not, see if the user would like to create one.
-        format = getFormat(format_type)
-        if device.partitionable and not format.hidden:
+        if device.partitionable and not \
+            (udev_device_is_multipath_member(info) or
+             udev_device_is_biosraid(info)):
             self.handleUdevDiskLabelFormat(info, device)
             if device.partitioned or self.isIgnored(info):
                 # If the device has a disklabel, or the user chose not to

This way there is no need to do the no args given getFormat (which then later
gets replaced with a new getFormat call with args), and as hidden is not
reliable here yet and we are hardcoding knowledge about which udev types to
skip, it might be better to not use hidden at all and simply list all the
udev types which should not undergo disklabel handling.

Note this is just a suggestion, I know this aint perfect either :)

diff --git a/storage/formats/mdraid.py b/storage/formats/mdraid.py
index 17b01bb..9983da4 100644
--- a/storage/formats/mdraid.py
+++ b/storage/formats/mdraid.py
@@ -64,6 +64,7 @@ class MDRaidMember(DeviceFormat):
          self.raidMinor = None

          #self.probe()
+        self.biosraid = False

      def probe(self):
          """ Probe for any missing information about this format. """
@@ -93,6 +94,10 @@ class MDRaidMember(DeviceFormat):
          # XXX hack -- we don't have a nice way to see if the array is active
          return False

+    @property
+    def hidden(self):
+        return (self._hidden or self.biosraid)
+
      def writeKS(self, f):
          f.write("raid.%s" % self.mdUuid)


Regards,

Hans

_______________________________________________
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