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

[PATCH 1/2] Only pass --update=super-minor when activating v0 metadata md arrays.



To minimize behavioral changes from 6.0 to 6.1 we track existing arrays'
metadata version so we know which ones can take --update=super-minor. In
Fedora we are discontinuing use of --update=super-minor.

Resolves: rhbz#681136
---
 storage/devices.py    |   25 ++++++++++++++++---------
 storage/devicetree.py |    2 ++
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index d21172b..7e4c56a 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -2540,7 +2540,7 @@ class MDRaidArrayDevice(StorageDevice):
 
     def __init__(self, name, level=None, major=None, minor=None, size=None,
                  memberDevices=None, totalDevices=None,
-                 uuid=None, format=None, exists=None,
+                 uuid=None, format=None, exists=None, metadataVersion=None,
                  parents=None, sysfsPath=''):
         """ Create a MDRaidArrayDevice instance.
 
@@ -2551,6 +2551,7 @@ class MDRaidArrayDevice(StorageDevice):
             Keyword Arguments:
 
                 level -- the device's RAID level (a string, eg: '1' or 'raid1')
+                metadataVersion -- the version of the device's md metadata
                 parents -- list of member devices (StorageDevice instances)
                 size -- the device's size (units/format TBD)
                 uuid -- the device's UUID
@@ -2582,7 +2583,11 @@ class MDRaidArrayDevice(StorageDevice):
         self.chunkSize = 512.0 / 1024.0         # chunk size in MB
         self.superBlockSize = 2.0               # superblock size in MB
 
-        self.createMetadataVer = "1.1"
+        if not isinstance(metadataVersion, str):
+            self.metadataVersion = "1.1"
+        else:
+            self.metadataVersion = metadataVersion
+
         # bitmaps are not meaningful on raid0 according to mdadm-3.0.3
         self.createBitmap = self.level != 0
 
@@ -2667,9 +2672,12 @@ class MDRaidArrayDevice(StorageDevice):
         s = StorageDevice.__str__(self)
         s += ("  level = %(level)s  spares = %(spares)s\n"
               "  members = %(memberDevices)s\n"
-              "  total devices = %(totalDevices)s" %
+              "  total devices = %(totalDevices)s"
+              "  metadata version = %(metadataVersion)s" %
               {"level": self.level, "spares": self.spares,
-               "memberDevices": self.memberDevices, "totalDevices": self.totalDevices})
+               "memberDevices": self.memberDevices,
+               "totalDevices": self.totalDevices,
+               "metadataVersion": self.metadataVersion})
         return s
 
     @property
@@ -2677,7 +2685,8 @@ class MDRaidArrayDevice(StorageDevice):
         d = super(MDRaidArrayDevice, self).dict
         d.update({"level": self.level,
                   "spares": self.spares, "memberDevices": self.memberDevices,
-                  "totalDevices": self.totalDevices})
+                  "totalDevices": self.totalDevices,
+                  "metadataVersion": self.metadataVersion})
         return d
 
     def writeKS(self, f, preexisting=False, noformat=False, s=None):
@@ -2905,9 +2914,7 @@ class MDRaidArrayDevice(StorageDevice):
             member.setup(orig=orig)
             disks.append(member.path)
 
-        update_super_minor = True
-        if self.type == "mdcontainer" or self.type == "mdbiosraidarray":
-            update_super_minor = False
+        update_super_minor = self.metadataVersion in ("0", "0.90")
 
         mdraid.mdactivate(self.path,
                           members=disks,
@@ -2963,7 +2970,7 @@ class MDRaidArrayDevice(StorageDevice):
         if getattr(self.format, "mountpoint", None) == bootmountpoint or \
            getattr(self.format, "mountpoint", None) == "/boot/efi" or \
            self.format.type == "prepboot":
-            self.createMetadataVer = "1.0"
+            self.metadataVersion = "1.0"
 
         # Bitmaps are not useful for swap and small partitions
         if self.size < 1000 or self.format.type == "swap":
diff --git a/storage/devicetree.py b/storage/devicetree.py
index c9f84cb..63e8b8b 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1660,6 +1660,7 @@ class DeviceTree(object):
             # try to name the array based on the preferred minor
             md_info = devicelibs.mdraid.mdexamine(device.path)
             md_path = md_info.get("device", "")
+            md_metadata = md_info.get("metadata")
             md_name = devicePathToName(md_info.get("device", ""))
             if md_name:
                 try:
@@ -1695,6 +1696,7 @@ class DeviceTree(object):
                                          minor=minor,
                                          memberDevices=md_devices,
                                          uuid=md_uuid,
+                                         metadataVersion=md_metadata,
                                          sysfsPath=sysfs_path,
                                          exists=True)
             md_array._addDevice(device)
-- 
1.7.3.5


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