This is needed if we are to validate boot arrays' metadata version. (based on cherry pick of 9599b145793f3aa9e151f28c5cd2cda6f8dcd668) --- pyanaconda/storage/devices.py | 23 ++++++++++++++++------- pyanaconda/storage/devicetree.py | 5 ++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py index d3c3bda..cf68b57 100644 --- a/pyanaconda/storage/devices.py +++ b/pyanaconda/storage/devices.py @@ -2652,7 +2652,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. @@ -2663,6 +2663,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 @@ -2699,7 +2700,11 @@ class MDRaidArrayDevice(StorageDevice): self.chunkSize = 512.0 / 1024.0 # chunk size in MB self.superBlockSize = 2.0 # superblock size in MB - self.createMetadataVer = "default" + if not isinstance(metadataVersion, str): + self.metadataVersion = "default" + else: + self.metadataVersion = metadataVersion + # bitmaps are not meaningful on raid0 according to mdadm-3.0.3 self.createBitmap = self.level != 0 @@ -2784,9 +2789,12 @@ class MDRaidArrayDevice(StorageDevice): s = StorageDevice.__repr__(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 @@ -2794,7 +2802,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): @@ -3037,7 +3046,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": @@ -3062,7 +3071,7 @@ class MDRaidArrayDevice(StorageDevice): self.level, disks, spares, - metadataVer=self.createMetadataVer, + metadataVer=self.metadataVersion, bitmap=self.createBitmap, progress=w) diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py index 743760d..b735ec2 100644 --- a/pyanaconda/storage/devicetree.py +++ b/pyanaconda/storage/devicetree.py @@ -1382,9 +1382,11 @@ class DeviceTree(object): minor = udev_device_get_minor(dev) break + md_info = devicelibs.mdraid.mdexamine(device.path) + md_metadata = md_info.get("metadata") + if not md_name: # try to name the array based on the preferred minor - md_info = devicelibs.mdraid.mdexamine(device.path) md_path = md_info.get("device", "") md_name = devicePathToName(md_info.get("device", "")) if md_name: @@ -1422,6 +1424,7 @@ class DeviceTree(object): minor=minor, memberDevices=md_devices, uuid=md_uuid, + metadataVersion=md_metadata, sysfsPath=sysfs_path, exists=True) except ValueError as e: -- 1.7.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list