neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone

Blame SOURCES/0010-Fix-name-resolution-for-MD-devices-and-partitions-on.patch

5fed29
From 18ce766bc90abdf0d8ca54bdf578463392a52ee9 Mon Sep 17 00:00:00 2001
5fed29
From: Vojtech Trefny <vtrefny@redhat.com>
5fed29
Date: Wed, 12 Aug 2020 10:57:19 +0200
5fed29
Subject: [PATCH 1/2] Fix name resolution for MD devices and partitions on them
5fed29
5fed29
UDev data for both member disks/partitions and partitions on arrays
5fed29
contain the MD_* properties we must be extra careful when deciding
5fed29
what name we'll use for the device.
5fed29
5fed29
Resolves: rhbz#1862904
5fed29
---
5fed29
 blivet/udev.py | 12 ++++++++++--
5fed29
 1 file changed, 10 insertions(+), 2 deletions(-)
5fed29
5fed29
diff --git a/blivet/udev.py b/blivet/udev.py
5fed29
index 41c99496..c85eb3dc 100644
5fed29
--- a/blivet/udev.py
5fed29
+++ b/blivet/udev.py
5fed29
@@ -202,9 +202,16 @@ def device_get_name(udev_info):
5fed29
     """ Return the best name for a device based on the udev db data. """
5fed29
     if "DM_NAME" in udev_info:
5fed29
         name = udev_info["DM_NAME"]
5fed29
-    elif "MD_DEVNAME" in udev_info and os.path.exists(device_get_sysfs_path(udev_info) + "/md"):
5fed29
+    elif "MD_DEVNAME" in udev_info:
5fed29
         mdname = udev_info["MD_DEVNAME"]
5fed29
-        if device_is_partition(udev_info):
5fed29
+        if device_is_md(udev_info):
5fed29
+            # MD RAID array -> use MD_DEVNAME
5fed29
+            name = mdname
5fed29
+        elif device_get_format(udev_info) == "linux_raid_member":
5fed29
+            # MD RAID member -> use SYS_NAME
5fed29
+            name = udev_info["SYS_NAME"]
5fed29
+        elif device_is_partition(udev_info):
5fed29
+            # partition on RAID -> construct name from MD_DEVNAME + partition number
5fed29
             # for partitions on named RAID we want to use the raid name, not
5fed29
             # the node, e.g. "raid1" instead of "md127p1"
5fed29
             partnum = udev_info["ID_PART_ENTRY_NUMBER"]
5fed29
@@ -213,6 +220,7 @@ def device_get_name(udev_info):
5fed29
             else:
5fed29
                 name = mdname + partnum
5fed29
         else:
5fed29
+            # something else -> default to MD_DEVNAME
5fed29
             name = mdname
5fed29
     else:
5fed29
         name = udev_info["SYS_NAME"]
5fed29
-- 
5fed29
2.25.4
5fed29
5fed29
5fed29
From dc96961adcb9dd6ef6d09e4daaa0a5eaae1ffe60 Mon Sep 17 00:00:00 2001
5fed29
From: Vojtech Trefny <vtrefny@redhat.com>
5fed29
Date: Wed, 12 Aug 2020 11:10:03 +0200
5fed29
Subject: [PATCH 2/2] Add tests for udev.device_get_name for RAID devices
5fed29
5fed29
This includes sample UDev data for various combinations of RAID
5fed29
devices configuration.
5fed29
5fed29
Related: rhbz#1862904
5fed29
---
5fed29
 tests/udev_data/__init__.py  |   0
5fed29
 tests/udev_data/raid_data.py | 705 +++++++++++++++++++++++++++++++++++
5fed29
 tests/udev_test.py           |  46 +++
5fed29
 3 files changed, 751 insertions(+)
5fed29
 create mode 100644 tests/udev_data/__init__.py
5fed29
 create mode 100644 tests/udev_data/raid_data.py
5fed29
5fed29
diff --git a/tests/udev_data/__init__.py b/tests/udev_data/__init__.py
5fed29
new file mode 100644
5fed29
index 00000000..e69de29b
5fed29
diff --git a/tests/udev_data/raid_data.py b/tests/udev_data/raid_data.py
5fed29
new file mode 100644
5fed29
index 00000000..509cbfbd
5fed29
--- /dev/null
5fed29
+++ b/tests/udev_data/raid_data.py
5fed29
@@ -0,0 +1,705 @@
5fed29
+# Sample UDev data for various MD RAID devices:
5fed29
+# - member_boot: data for the member disk or partition after booting the system
5fed29
+# - member_assemble: data for the member disk or partition after re-assembling stopped array using
5fed29
+#                    'mdadm --assemble --scan' (yes, this is different from member_boot)
5fed29
+# - raid_device: data for the RAID array device
5fed29
+# - raid_partition: data for partition on the array
5fed29
+#
5fed29
+# We have data for different combinations of member "types", MD metadata versions and named v unnamed
5fed29
+# RAID devices.
5fed29
+# The data were gathered on Fedora 32.
5fed29
+
5fed29
+
5fed29
+class RaidOnDisk1():
5fed29
+    member_name = "sda"
5fed29
+    raid_name = "127"
5fed29
+    raid_node = "md127"
5fed29
+    metadata_version = "1.2"
5fed29
+
5fed29
+    member_boot = {'DEVLINKS': '/dev/disk/by-path/pci-0000:00:11.0-scsi-0:0:0:0 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0',
5fed29
+                   'DEVNAME': '/dev/sda',
5fed29
+                   'DEVPATH': '/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:0/block/sda',
5fed29
+                   'DEVTYPE': 'disk',
5fed29
+                   'ID_BUS': 'scsi',
5fed29
+                   'ID_FS_LABEL': 'localhost.localdomain:127',
5fed29
+                   'ID_FS_LABEL_ENC': 'localhost.localdomain:127',
5fed29
+                   'ID_FS_TYPE': 'linux_raid_member',
5fed29
+                   'ID_FS_USAGE': 'raid',
5fed29
+                   'ID_FS_UUID': '54956eb2-6983-8759-e2ad-4c40acc92e4b',
5fed29
+                   'ID_FS_UUID_ENC': '54956eb2-6983-8759-e2ad-4c40acc92e4b',
5fed29
+                   'ID_FS_UUID_SUB': '64f96f0b-e97c-9157-d393-1fe457f3dd59',
5fed29
+                   'ID_FS_UUID_SUB_ENC': '64f96f0b-e97c-9157-d393-1fe457f3dd59',
5fed29
+                   'ID_FS_VERSION': '1.2',
5fed29
+                   'ID_MODEL': 'QEMU_HARDDISK',
5fed29
+                   'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20',
5fed29
+                   'ID_PATH': 'pci-0000:00:11.0-scsi-0:0:0:0',
5fed29
+                   'ID_PATH_TAG': 'pci-0000_00_11_0-scsi-0_0_0_0',
5fed29
+                   'ID_REVISION': '2.5+',
5fed29
+                   'ID_SCSI': '1',
5fed29
+                   'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0',
5fed29
+                   'ID_SERIAL_SHORT': 'drive-scsi0-0-0-0',
5fed29
+                   'ID_TYPE': 'disk',
5fed29
+                   'ID_VENDOR': 'QEMU',
5fed29
+                   'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20',
5fed29
+                   'MAJOR': '8',
5fed29
+                   'MD_DEVICE': 'md127',
5fed29
+                   'MD_DEVNAME': '127',
5fed29
+                   'MD_FOREIGN': 'no',
5fed29
+                   'MD_STARTED': 'unsafe',
5fed29
+                   'MINOR': '0',
5fed29
+                   'SUBSYSTEM': 'block',
5fed29
+                   'SYSTEMD_WANTS': 'mdadm-last-resort@md127.timer',
5fed29
+                   'TAGS': ':systemd:',
5fed29
+                   'USEC_INITIALIZED': '5529231',
5fed29
+                   'SYS_NAME': 'sda',
5fed29
+                   'SYS_PATH': '/sys/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:0/block/sda'}
5fed29
+
5fed29
+    member_assemble = {'DEVLINKS': '/dev/disk/by-path/pci-0000:00:11.0-scsi-0:0:0:0 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0',
5fed29
+                       'DEVNAME': '/dev/sda',
5fed29
+                       'DEVPATH': '/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:0/block/sda',
5fed29
+                       'DEVTYPE': 'disk',
5fed29
+                       'ID_BUS': 'scsi',
5fed29
+                       'ID_FS_LABEL': 'localhost.localdomain:127',
5fed29
+                       'ID_FS_LABEL_ENC': 'localhost.localdomain:127',
5fed29
+                       'ID_FS_TYPE': 'linux_raid_member',
5fed29
+                       'ID_FS_USAGE': 'raid',
5fed29
+                       'ID_FS_UUID': '54956eb2-6983-8759-e2ad-4c40acc92e4b',
5fed29
+                       'ID_FS_UUID_ENC': '54956eb2-6983-8759-e2ad-4c40acc92e4b',
5fed29
+                       'ID_FS_UUID_SUB': '64f96f0b-e97c-9157-d393-1fe457f3dd59',
5fed29
+                       'ID_FS_UUID_SUB_ENC': '64f96f0b-e97c-9157-d393-1fe457f3dd59',
5fed29
+                       'ID_FS_VERSION': '1.2',
5fed29
+                       'ID_MODEL': 'QEMU_HARDDISK',
5fed29
+                       'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20',
5fed29
+                       'ID_PATH': 'pci-0000:00:11.0-scsi-0:0:0:0',
5fed29
+                       'ID_PATH_TAG': 'pci-0000_00_11_0-scsi-0_0_0_0',
5fed29
+                       'ID_REVISION': '2.5+',
5fed29
+                       'ID_SCSI': '1',
5fed29
+                       'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0',
5fed29
+                       'ID_SERIAL_SHORT': 'drive-scsi0-0-0-0',
5fed29
+                       'ID_TYPE': 'disk',
5fed29
+                       'ID_VENDOR': 'QEMU',
5fed29
+                       'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20',
5fed29
+                       'MAJOR': '8',
5fed29
+                       'MINOR': '0',
5fed29
+                       'SUBSYSTEM': 'block',
5fed29
+                       'TAGS': ':systemd:',
5fed29
+                       'USEC_INITIALIZED': '5529231',
5fed29
+                       'SYS_NAME': 'sda',
5fed29
+                       'SYS_PATH': '/sys/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:0/block/sda'}
5fed29
+
5fed29
+    raid_device = {'DEVLINKS': '/dev/disk/by-id/md-name-localhost.localdomain:127 /dev/disk/by-id/md-uuid-54956eb2:69838759:e2ad4c40:acc92e4b /dev/md/127',
5fed29
+                   'DEVNAME': '/dev/md127',
5fed29
+                   'DEVPATH': '/devices/virtual/block/md127',
5fed29
+                   'DEVTYPE': 'disk',
5fed29
+                   'ID_PART_TABLE_TYPE': 'dos',
5fed29
+                   'ID_PART_TABLE_UUID': '4eec0361',
5fed29
+                   'MAJOR': '9',
5fed29
+                   'MD_DEVICES': '2',
5fed29
+                   'MD_DEVICE_ev_sda_DEV': '/dev/sda',
5fed29
+                   'MD_DEVICE_ev_sda_ROLE': '0',
5fed29
+                   'MD_DEVICE_ev_sdb_DEV': '/dev/sdb',
5fed29
+                   'MD_DEVICE_ev_sdb_ROLE': '1',
5fed29
+                   'MD_DEVNAME': '127',
5fed29
+                   'MD_LEVEL': 'raid1',
5fed29
+                   'MD_METADATA': '1.2',
5fed29
+                   'MD_NAME': 'localhost.localdomain:127',
5fed29
+                   'MD_UUID': '54956eb2:69838759:e2ad4c40:acc92e4b',
5fed29
+                   'MINOR': '127',
5fed29
+                   'SUBSYSTEM': 'block',
5fed29
+                   'SYSTEMD_WANTS': 'mdmonitor.service',
5fed29
+                   'TAGS': ':systemd:',
5fed29
+                   'USEC_INITIALIZED': '603606045',
5fed29
+                   'SYS_NAME': 'md127',
5fed29
+                   'SYS_PATH': '/sys/devices/virtual/block/md127'}
5fed29
+
5fed29
+    raid_partition = {'DEVLINKS': '/dev/md/127p1 /dev/disk/by-id/md-uuid-54956eb2:69838759:e2ad4c40:acc92e4b-part1 /dev/disk/by-id/md-name-localhost.localdomain:127-part1',
5fed29
+                      'DEVNAME': '/dev/md127p1',
5fed29
+                      'DEVPATH': '/devices/virtual/block/md127/md127p1',
5fed29
+                      'DEVTYPE': 'partition',
5fed29
+                      'ID_PART_ENTRY_DISK': '9:127',
5fed29
+                      'ID_PART_ENTRY_NUMBER': '1',
5fed29
+                      'ID_PART_ENTRY_OFFSET': '2048',
5fed29
+                      'ID_PART_ENTRY_SCHEME': 'dos',
5fed29
+                      'ID_PART_ENTRY_SIZE': '2091008',
5fed29
+                      'ID_PART_ENTRY_TYPE': '0x83',
5fed29
+                      'ID_PART_ENTRY_UUID': '4eec0361-01',
5fed29
+                      'MAJOR': '259',
5fed29
+                      'MD_DEVICES': '2',
5fed29
+                      'MD_DEVICE_ev_sda_DEV': '/dev/sda',
5fed29
+                      'MD_DEVICE_ev_sda_ROLE': '0',
5fed29
+                      'MD_DEVICE_ev_sdb_DEV': '/dev/sdb',
5fed29
+                      'MD_DEVICE_ev_sdb_ROLE': '1',
5fed29
+                      'MD_DEVNAME': '127',
5fed29
+                      'MD_LEVEL': 'raid1',
5fed29
+                      'MD_METADATA': '1.2',
5fed29
+                      'MD_NAME': 'localhost.localdomain:127',
5fed29
+                      'MD_UUID': '54956eb2:69838759:e2ad4c40:acc92e4b',
5fed29
+                      'MINOR': '2',
5fed29
+                      'PARTN': '1',
5fed29
+                      'SUBSYSTEM': 'block',
5fed29
+                      'SYSTEMD_WANTS': 'mdmonitor.service',
5fed29
+                      'TAGS': ':systemd:',
5fed29
+                      'USEC_INITIALIZED': '603714783',
5fed29
+                      'SYS_NAME': 'md127p1',
5fed29
+                      'SYS_PATH': '/sys/devices/virtual/block/md127/md127p1'}
5fed29
+
5fed29
+
5fed29
+class RaidOnDisk2():
5fed29
+    member_name = "sdc"
5fed29
+    raid_name = "name"
5fed29
+    raid_node = "md127"
5fed29
+    metadata_version = "1.2"
5fed29
+
5fed29
+    member_boot = {'DEVLINKS': '/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-4 /dev/disk/by-path/pci-0000:00:11.0-scsi-0:0:0:4',
5fed29
+                   'DEVNAME': '/dev/sdc',
5fed29
+                   'DEVPATH': '/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:4/block/sdc',
5fed29
+                   'DEVTYPE': 'disk',
5fed29
+                   'ID_BUS': 'scsi',
5fed29
+                   'ID_FS_LABEL': 'localhost.localdomain:name',
5fed29
+                   'ID_FS_LABEL_ENC': 'localhost.localdomain:name',
5fed29
+                   'ID_FS_TYPE': 'linux_raid_member',
5fed29
+                   'ID_FS_USAGE': 'raid',
5fed29
+                   'ID_FS_UUID': '143d480c-12c3-909f-5476-98a9f94a1c4f',
5fed29
+                   'ID_FS_UUID_ENC': '143d480c-12c3-909f-5476-98a9f94a1c4f',
5fed29
+                   'ID_FS_UUID_SUB': '121f2b71-3634-4183-dc9c-08bfceda765c',
5fed29
+                   'ID_FS_UUID_SUB_ENC': '121f2b71-3634-4183-dc9c-08bfceda765c',
5fed29
+                   'ID_FS_VERSION': '1.2',
5fed29
+                   'ID_MODEL': 'QEMU_HARDDISK',
5fed29
+                   'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20',
5fed29
+                   'ID_PATH': 'pci-0000:00:11.0-scsi-0:0:0:4',
5fed29
+                   'ID_PATH_TAG': 'pci-0000_00_11_0-scsi-0_0_0_4',
5fed29
+                   'ID_REVISION': '2.5+',
5fed29
+                   'ID_SCSI': '1',
5fed29
+                   'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-4',
5fed29
+                   'ID_SERIAL_SHORT': 'drive-scsi0-0-0-4',
5fed29
+                   'ID_TYPE': 'disk',
5fed29
+                   'ID_VENDOR': 'QEMU',
5fed29
+                   'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20',
5fed29
+                   'MAJOR': '8',
5fed29
+                   'MD_DEVICE': 'md127',
5fed29
+                   'MD_DEVNAME': 'name',
5fed29
+                   'MD_FOREIGN': 'no',
5fed29
+                   'MD_STARTED': 'yes',
5fed29
+                   'MINOR': '32',
5fed29
+                   'SUBSYSTEM': 'block',
5fed29
+                   'TAGS': ':systemd:',
5fed29
+                   'USEC_INITIALIZED': '6109555',
5fed29
+                   'SYS_NAME': 'sdc',
5fed29
+                   'SYS_PATH': '/sys/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:4/block/sdc'}
5fed29
+
5fed29
+    member_assemble = {'DEVLINKS': '/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-4 /dev/disk/by-path/pci-0000:00:11.0-scsi-0:0:0:4',
5fed29
+                       'DEVNAME': '/dev/sdc',
5fed29
+                       'DEVPATH': '/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:4/block/sdc',
5fed29
+                       'DEVTYPE': 'disk',
5fed29
+                       'ID_BUS': 'scsi',
5fed29
+                       'ID_FS_LABEL': 'localhost.localdomain:name',
5fed29
+                       'ID_FS_LABEL_ENC': 'localhost.localdomain:name',
5fed29
+                       'ID_FS_TYPE': 'linux_raid_member',
5fed29
+                       'ID_FS_USAGE': 'raid',
5fed29
+                       'ID_FS_UUID': '143d480c-12c3-909f-5476-98a9f94a1c4f',
5fed29
+                       'ID_FS_UUID_ENC': '143d480c-12c3-909f-5476-98a9f94a1c4f',
5fed29
+                       'ID_FS_UUID_SUB': '121f2b71-3634-4183-dc9c-08bfceda765c',
5fed29
+                       'ID_FS_UUID_SUB_ENC': '121f2b71-3634-4183-dc9c-08bfceda765c',
5fed29
+                       'ID_FS_VERSION': '1.2',
5fed29
+                       'ID_MODEL': 'QEMU_HARDDISK',
5fed29
+                       'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20',
5fed29
+                       'ID_PATH': 'pci-0000:00:11.0-scsi-0:0:0:4',
5fed29
+                       'ID_PATH_TAG': 'pci-0000_00_11_0-scsi-0_0_0_4',
5fed29
+                       'ID_REVISION': '2.5+',
5fed29
+                       'ID_SCSI': '1',
5fed29
+                       'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-4',
5fed29
+                       'ID_SERIAL_SHORT': 'drive-scsi0-0-0-4',
5fed29
+                       'ID_TYPE': 'disk',
5fed29
+                       'ID_VENDOR': 'QEMU',
5fed29
+                       'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20',
5fed29
+                       'MAJOR': '8',
5fed29
+                       'MINOR': '32',
5fed29
+                       'SUBSYSTEM': 'block',
5fed29
+                       'TAGS': ':systemd:',
5fed29
+                       'USEC_INITIALIZED': '6109555',
5fed29
+                       'SYS_NAME': 'sdc',
5fed29
+                       'SYS_PATH': '/sys/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:4/block/sdc'}
5fed29
+
5fed29
+    raid_device = {'DEVLINKS': '/dev/disk/by-id/md-name-localhost.localdomain:name /dev/disk/by-id/md-uuid-143d480c:12c3909f:547698a9:f94a1c4f /dev/md/name',
5fed29
+                   'DEVNAME': '/dev/md127',
5fed29
+                   'DEVPATH': '/devices/virtual/block/md127',
5fed29
+                   'DEVTYPE': 'disk',
5fed29
+                   'ID_PART_TABLE_TYPE': 'dos',
5fed29
+                   'ID_PART_TABLE_UUID': '19e9cb5b',
5fed29
+                   'MAJOR': '9',
5fed29
+                   'MD_DEVICES': '2',
5fed29
+                   'MD_DEVICE_ev_sdc_DEV': '/dev/sdc',
5fed29
+                   'MD_DEVICE_ev_sdc_ROLE': '0',
5fed29
+                   'MD_DEVICE_ev_sdd_DEV': '/dev/sdd',
5fed29
+                   'MD_DEVICE_ev_sdd_ROLE': '1',
5fed29
+                   'MD_DEVNAME': 'name',
5fed29
+                   'MD_LEVEL': 'raid1',
5fed29
+                   'MD_METADATA': '1.2',
5fed29
+                   'MD_NAME': 'localhost.localdomain:name',
5fed29
+                   'MD_UUID': '143d480c:12c3909f:547698a9:f94a1c4f',
5fed29
+                   'MINOR': '127',
5fed29
+                   'SUBSYSTEM': 'block',
5fed29
+                   'SYSTEMD_WANTS': 'mdmonitor.service',
5fed29
+                   'TAGS': ':systemd:',
5fed29
+                   'USEC_INITIALIZED': '5844744',
5fed29
+                   'SYS_NAME': 'md127',
5fed29
+                   'SYS_PATH': '/sys/devices/virtual/block/md127'}
5fed29
+
5fed29
+    raid_partition = {'DEVLINKS': '/dev/disk/by-id/md-uuid-143d480c:12c3909f:547698a9:f94a1c4f-part1 /dev/disk/by-id/md-name-localhost.localdomain:name-part1 /dev/md/name1',
5fed29
+                      'DEVNAME': '/dev/md127p1',
5fed29
+                      'DEVPATH': '/devices/virtual/block/md127/md127p1',
5fed29
+                      'DEVTYPE': 'partition',
5fed29
+                      'ID_PART_ENTRY_DISK': '9:127',
5fed29
+                      'ID_PART_ENTRY_NUMBER': '1',
5fed29
+                      'ID_PART_ENTRY_OFFSET': '2048',
5fed29
+                      'ID_PART_ENTRY_SCHEME': 'dos',
5fed29
+                      'ID_PART_ENTRY_SIZE': '2091008',
5fed29
+                      'ID_PART_ENTRY_TYPE': '0x83',
5fed29
+                      'ID_PART_ENTRY_UUID': '19e9cb5b-01',
5fed29
+                      'ID_PART_TABLE_TYPE': 'dos',
5fed29
+                      'ID_PART_TABLE_UUID': 'ec985633',
5fed29
+                      'MAJOR': '259',
5fed29
+                      'MD_DEVICES': '2',
5fed29
+                      'MD_DEVICE_ev_sdc_DEV': '/dev/sdc',
5fed29
+                      'MD_DEVICE_ev_sdc_ROLE': '0',
5fed29
+                      'MD_DEVICE_ev_sdd_DEV': '/dev/sdd',
5fed29
+                      'MD_DEVICE_ev_sdd_ROLE': '1',
5fed29
+                      'MD_DEVNAME': 'name',
5fed29
+                      'MD_LEVEL': 'raid1',
5fed29
+                      'MD_METADATA': '1.2',
5fed29
+                      'MD_NAME': 'localhost.localdomain:name',
5fed29
+                      'MD_UUID': '143d480c:12c3909f:547698a9:f94a1c4f',
5fed29
+                      'MINOR': '1',
5fed29
+                      'PARTN': '1',
5fed29
+                      'SUBSYSTEM': 'block',
5fed29
+                      'SYSTEMD_WANTS': 'mdmonitor.service',
5fed29
+                      'TAGS': ':systemd:',
5fed29
+                      'USEC_INITIALIZED': '5928255',
5fed29
+                      'SYS_NAME': 'md127p1',
5fed29
+                      'SYS_PATH': '/sys/devices/virtual/block/md127/md127p1'}
5fed29
+
5fed29
+
5fed29
+class RaidOnDisk3():
5fed29
+    member_name = "sde"
5fed29
+    raid_name = "125"
5fed29
+    raid_node = "md125"
5fed29
+    metadata_version = "0.9"
5fed29
+
5fed29
+    member_boot = {'DEVLINKS': '/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-1 /dev/disk/by-path/pci-0000:00:11.0-scsi-0:0:0:1',
5fed29
+                   'DEVNAME': '/dev/sde',
5fed29
+                   'DEVPATH': '/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:1/block/sde',
5fed29
+                   'DEVTYPE': 'disk',
5fed29
+                   'ID_BUS': 'scsi',
5fed29
+                   'ID_FS_TYPE': 'linux_raid_member',
5fed29
+                   'ID_FS_USAGE': 'raid',
5fed29
+                   'ID_FS_UUID': 'c4ef60f5-e374-5f70-bfe7-8010bc810f04',
5fed29
+                   'ID_FS_UUID_ENC': 'c4ef60f5-e374-5f70-bfe7-8010bc810f04',
5fed29
+                   'ID_FS_VERSION': '0.90.0',
5fed29
+                   'ID_MODEL': 'QEMU_HARDDISK',
5fed29
+                   'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20',
5fed29
+                   'ID_PATH': 'pci-0000:00:11.0-scsi-0:0:0:1',
5fed29
+                   'ID_PATH_TAG': 'pci-0000_00_11_0-scsi-0_0_0_1',
5fed29
+                   'ID_REVISION': '2.5+',
5fed29
+                   'ID_SCSI': '1',
5fed29
+                   'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-1',
5fed29
+                   'ID_SERIAL_SHORT': 'drive-scsi0-0-0-1',
5fed29
+                   'ID_TYPE': 'disk',
5fed29
+                   'ID_VENDOR': 'QEMU',
5fed29
+                   'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20',
5fed29
+                   'MAJOR': '8',
5fed29
+                   'MD_DEVICE': 'md125',
5fed29
+                   'MD_DEVNAME': '125',
5fed29
+                   'MD_FOREIGN': 'no',
5fed29
+                   'MD_STARTED': 'unsafe',
5fed29
+                   'MINOR': '64',
5fed29
+                   'SUBSYSTEM': 'block',
5fed29
+                   'SYSTEMD_WANTS': 'mdadm-last-resort@md125.timer',
5fed29
+                   'TAGS': ':systemd:',
5fed29
+                   'USEC_INITIALIZED': '5538551',
5fed29
+                   'SYS_NAME': 'sde',
5fed29
+                   'SYS_PATH': '/sys/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:1/block/sde'}
5fed29
+
5fed29
+    member_assemble = {'DEVLINKS': '/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-1 /dev/disk/by-path/pci-0000:00:11.0-scsi-0:0:0:1',
5fed29
+                       'DEVNAME': '/dev/sde',
5fed29
+                       'DEVPATH': '/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:1/block/sde',
5fed29
+                       'DEVTYPE': 'disk',
5fed29
+                       'ID_BUS': 'scsi',
5fed29
+                       'ID_FS_TYPE': 'linux_raid_member',
5fed29
+                       'ID_FS_USAGE': 'raid',
5fed29
+                       'ID_FS_UUID': 'c4ef60f5-e374-5f70-bfe7-8010bc810f04',
5fed29
+                       'ID_FS_UUID_ENC': 'c4ef60f5-e374-5f70-bfe7-8010bc810f04',
5fed29
+                       'ID_FS_VERSION': '0.90.0',
5fed29
+                       'ID_MODEL': 'QEMU_HARDDISK',
5fed29
+                       'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20',
5fed29
+                       'ID_PATH': 'pci-0000:00:11.0-scsi-0:0:0:1',
5fed29
+                       'ID_PATH_TAG': 'pci-0000_00_11_0-scsi-0_0_0_1',
5fed29
+                       'ID_REVISION': '2.5+',
5fed29
+                       'ID_SCSI': '1',
5fed29
+                       'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-1',
5fed29
+                       'ID_SERIAL_SHORT': 'drive-scsi0-0-0-1',
5fed29
+                       'ID_TYPE': 'disk',
5fed29
+                       'ID_VENDOR': 'QEMU',
5fed29
+                       'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20',
5fed29
+                       'MAJOR': '8',
5fed29
+                       'MINOR': '64',
5fed29
+                       'SUBSYSTEM': 'block',
5fed29
+                       'TAGS': ':systemd:',
5fed29
+                       'USEC_INITIALIZED': '5538551',
5fed29
+                       'SYS_NAME': 'sde',
5fed29
+                       'SYS_PATH': '/sys/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:1/block/sde'}
5fed29
+
5fed29
+    raid_device = {'DEVLINKS': '/dev/md/125 /dev/disk/by-id/md-uuid-c4ef60f5:e3745f70:bfe78010:bc810f04',
5fed29
+                   'DEVNAME': '/dev/md125',
5fed29
+                   'DEVPATH': '/devices/virtual/block/md125',
5fed29
+                   'DEVTYPE': 'disk',
5fed29
+                   'ID_PART_TABLE_TYPE': 'dos',
5fed29
+                   'ID_PART_TABLE_UUID': 'e74877cd',
5fed29
+                   'MAJOR': '9',
5fed29
+                   'MD_DEVICES': '2',
5fed29
+                   'MD_DEVICE_ev_sde_DEV': '/dev/sde',
5fed29
+                   'MD_DEVICE_ev_sde_ROLE': '0',
5fed29
+                   'MD_DEVICE_ev_sdf_DEV': '/dev/sdf',
5fed29
+                   'MD_DEVICE_ev_sdf_ROLE': '1',
5fed29
+                   'MD_DEVNAME': '125',
5fed29
+                   'MD_LEVEL': 'raid1',
5fed29
+                   'MD_METADATA': '0.90',
5fed29
+                   'MD_UUID': 'c4ef60f5:e3745f70:bfe78010:bc810f04',
5fed29
+                   'MINOR': '125',
5fed29
+                   'SUBSYSTEM': 'block',
5fed29
+                   'SYSTEMD_WANTS': 'mdmonitor.service',
5fed29
+                   'TAGS': ':systemd:',
5fed29
+                   'USEC_INITIALIZED': '5786380',
5fed29
+                   'SYS_NAME': 'md125',
5fed29
+                   'SYS_PATH': '/sys/devices/virtual/block/md125'}
5fed29
+
5fed29
+    raid_partition = {'DEVLINKS': '/dev/md/125p1 /dev/disk/by-id/md-uuid-c4ef60f5:e3745f70:bfe78010:bc810f04-part1',
5fed29
+                      'DEVNAME': '/dev/md125p1',
5fed29
+                      'DEVPATH': '/devices/virtual/block/md125/md125p1',
5fed29
+                      'DEVTYPE': 'partition',
5fed29
+                      'ID_PART_ENTRY_DISK': '9:125',
5fed29
+                      'ID_PART_ENTRY_NUMBER': '1',
5fed29
+                      'ID_PART_ENTRY_OFFSET': '2048',
5fed29
+                      'ID_PART_ENTRY_SCHEME': 'dos',
5fed29
+                      'ID_PART_ENTRY_SIZE': '2094976',
5fed29
+                      'ID_PART_ENTRY_TYPE': '0x83',
5fed29
+                      'ID_PART_ENTRY_UUID': 'e74877cd-01',
5fed29
+                      'MAJOR': '259',
5fed29
+                      'MD_DEVICES': '2',
5fed29
+                      'MD_DEVICE_ev_sde_DEV': '/dev/sde',
5fed29
+                      'MD_DEVICE_ev_sde_ROLE': '0',
5fed29
+                      'MD_DEVICE_ev_sdf_DEV': '/dev/sdf',
5fed29
+                      'MD_DEVICE_ev_sdf_ROLE': '1',
5fed29
+                      'MD_DEVNAME': '125',
5fed29
+                      'MD_LEVEL': 'raid1',
5fed29
+                      'MD_METADATA': '0.90',
5fed29
+                      'MD_UUID': 'c4ef60f5:e3745f70:bfe78010:bc810f04',
5fed29
+                      'MINOR': '3',
5fed29
+                      'PARTN': '1',
5fed29
+                      'SUBSYSTEM': 'block',
5fed29
+                      'SYSTEMD_WANTS': 'mdmonitor.service',
5fed29
+                      'TAGS': ':systemd:',
5fed29
+                      'USEC_INITIALIZED': '8808457',
5fed29
+                      'SYS_NAME': 'md125p1',
5fed29
+                      'SYS_PATH': '/sys/devices/virtual/block/md125/md125p1'}
5fed29
+
5fed29
+
5fed29
+class RaidOnPartition1():
5fed29
+    member_name = "sdh3"
5fed29
+    raid_name = "122"
5fed29
+    raid_node = "md122"
5fed29
+    metadata_version = "1.2"
5fed29
+
5fed29
+    member_boot = {'DEVLINKS': '/dev/disk/by-path/pci-0000:00:07.0-scsi-0:0:2:0-part3 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi1-0-2-part3 /dev/disk/by-partuuid/73eb11a9-03',
5fed29
+                   'DEVNAME': '/dev/sdh3',
5fed29
+                   'DEVPATH': '/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh3',
5fed29
+                   'DEVTYPE': 'partition',
5fed29
+                   'ID_BUS': 'scsi',
5fed29
+                   'ID_FS_LABEL': 'localhost.localdomain:122',
5fed29
+                   'ID_FS_LABEL_ENC': 'localhost.localdomain:122',
5fed29
+                   'ID_FS_TYPE': 'linux_raid_member',
5fed29
+                   'ID_FS_USAGE': 'raid',
5fed29
+                   'ID_FS_UUID': '0628d995-eb60-ebd1-a767-51730b16f212',
5fed29
+                   'ID_FS_UUID_ENC': '0628d995-eb60-ebd1-a767-51730b16f212',
5fed29
+                   'ID_FS_UUID_SUB': 'b301779b-f759-ad7d-5324-b38d4b6d944d',
5fed29
+                   'ID_FS_UUID_SUB_ENC': 'b301779b-f759-ad7d-5324-b38d4b6d944d',
5fed29
+                   'ID_FS_VERSION': '1.2',
5fed29
+                   'ID_MODEL': 'QEMU_HARDDISK',
5fed29
+                   'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20',
5fed29
+                   'ID_PART_ENTRY_DISK': '8:112',
5fed29
+                   'ID_PART_ENTRY_NUMBER': '3',
5fed29
+                   'ID_PART_ENTRY_OFFSET': '411648',
5fed29
+                   'ID_PART_ENTRY_SCHEME': 'dos',
5fed29
+                   'ID_PART_ENTRY_SIZE': '204800',
5fed29
+                   'ID_PART_ENTRY_TYPE': '0x83',
5fed29
+                   'ID_PART_ENTRY_UUID': '73eb11a9-03',
5fed29
+                   'ID_PART_TABLE_TYPE': 'dos',
5fed29
+                   'ID_PART_TABLE_UUID': '73eb11a9',
5fed29
+                   'ID_PATH': 'pci-0000:00:07.0-scsi-0:0:2:0',
5fed29
+                   'ID_PATH_TAG': 'pci-0000_00_07_0-scsi-0_0_2_0',
5fed29
+                   'ID_REVISION': '2.5+',
5fed29
+                   'ID_SCSI': '1',
5fed29
+                   'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi1-0-2',
5fed29
+                   'ID_SERIAL_SHORT': 'drive-scsi1-0-2',
5fed29
+                   'ID_TYPE': 'disk',
5fed29
+                   'ID_VENDOR': 'QEMU',
5fed29
+                   'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20',
5fed29
+                   'MAJOR': '8',
5fed29
+                   'MD_DEVICE': 'md122',
5fed29
+                   'MD_DEVNAME': '122',
5fed29
+                   'MD_FOREIGN': 'no',
5fed29
+                   'MD_STARTED': 'yes',
5fed29
+                   'MINOR': '115',
5fed29
+                   'PARTN': '3',
5fed29
+                   'SUBSYSTEM': 'block',
5fed29
+                   'TAGS': ':systemd:',
5fed29
+                   'USEC_INITIALIZED': '8920462',
5fed29
+                   'SYS_NAME': 'sdh3',
5fed29
+                   'SYS_PATH': '/sys/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh3'}
5fed29
+
5fed29
+    member_assemble = {'DEVLINKS': '/dev/disk/by-path/pci-0000:00:07.0-scsi-0:0:2:0-part3 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi1-0-2-part3 /dev/disk/by-partuuid/73eb11a9-03',
5fed29
+                       'DEVNAME': '/dev/sdh3',
5fed29
+                       'DEVPATH': '/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh3',
5fed29
+                       'DEVTYPE': 'partition',
5fed29
+                       'ID_BUS': 'scsi',
5fed29
+                       'ID_FS_LABEL': 'localhost.localdomain:122',
5fed29
+                       'ID_FS_LABEL_ENC': 'localhost.localdomain:122',
5fed29
+                       'ID_FS_TYPE': 'linux_raid_member',
5fed29
+                       'ID_FS_USAGE': 'raid',
5fed29
+                       'ID_FS_UUID': '0628d995-eb60-ebd1-a767-51730b16f212',
5fed29
+                       'ID_FS_UUID_ENC': '0628d995-eb60-ebd1-a767-51730b16f212',
5fed29
+                       'ID_FS_UUID_SUB': 'b301779b-f759-ad7d-5324-b38d4b6d944d',
5fed29
+                       'ID_FS_UUID_SUB_ENC': 'b301779b-f759-ad7d-5324-b38d4b6d944d',
5fed29
+                       'ID_FS_VERSION': '1.2',
5fed29
+                       'ID_MODEL': 'QEMU_HARDDISK',
5fed29
+                       'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20',
5fed29
+                       'ID_PART_ENTRY_DISK': '8:112',
5fed29
+                       'ID_PART_ENTRY_NUMBER': '3',
5fed29
+                       'ID_PART_ENTRY_OFFSET': '411648',
5fed29
+                       'ID_PART_ENTRY_SCHEME': 'dos',
5fed29
+                       'ID_PART_ENTRY_SIZE': '204800',
5fed29
+                       'ID_PART_ENTRY_TYPE': '0x83',
5fed29
+                       'ID_PART_ENTRY_UUID': '73eb11a9-03',
5fed29
+                       'ID_PART_TABLE_TYPE': 'dos',
5fed29
+                       'ID_PART_TABLE_UUID': '73eb11a9',
5fed29
+                       'ID_PATH': 'pci-0000:00:07.0-scsi-0:0:2:0',
5fed29
+                       'ID_PATH_TAG': 'pci-0000_00_07_0-scsi-0_0_2_0',
5fed29
+                       'ID_REVISION': '2.5+',
5fed29
+                       'ID_SCSI': '1',
5fed29
+                       'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi1-0-2',
5fed29
+                       'ID_SERIAL_SHORT': 'drive-scsi1-0-2',
5fed29
+                       'ID_TYPE': 'disk',
5fed29
+                       'ID_VENDOR': 'QEMU',
5fed29
+                       'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20',
5fed29
+                       'MAJOR': '8',
5fed29
+                       'MINOR': '115',
5fed29
+                       'PARTN': '3',
5fed29
+                       'SUBSYSTEM': 'block',
5fed29
+                       'TAGS': ':systemd:',
5fed29
+                       'USEC_INITIALIZED': '8920462',
5fed29
+                       'SYS_NAME': 'sdh3',
5fed29
+                       'SYS_PATH': '/sys/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh3'}
5fed29
+
5fed29
+    raid_device = {'DEVLINKS': '/dev/disk/by-id/md-uuid-0628d995:eb60ebd1:a7675173:0b16f212 /dev/disk/by-id/md-name-localhost.localdomain:122 /dev/md/122',
5fed29
+                   'DEVNAME': '/dev/md122',
5fed29
+                   'DEVPATH': '/devices/virtual/block/md122',
5fed29
+                   'DEVTYPE': 'disk',
5fed29
+                   'ID_PART_TABLE_TYPE': 'dos',
5fed29
+                   'ID_PART_TABLE_UUID': '6dc80b3b',
5fed29
+                   'MAJOR': '9',
5fed29
+                   'MD_DEVICES': '2',
5fed29
+                   'MD_DEVICE_ev_sdh3_DEV': '/dev/sdh3',
5fed29
+                   'MD_DEVICE_ev_sdh3_ROLE': '0',
5fed29
+                   'MD_DEVICE_ev_sdh5_DEV': '/dev/sdh5',
5fed29
+                   'MD_DEVICE_ev_sdh5_ROLE': '1',
5fed29
+                   'MD_DEVNAME': '122',
5fed29
+                   'MD_LEVEL': 'raid1',
5fed29
+                   'MD_METADATA': '1.2',
5fed29
+                   'MD_NAME': 'localhost.localdomain:122',
5fed29
+                   'MD_UUID': '0628d995:eb60ebd1:a7675173:0b16f212',
5fed29
+                   'MINOR': '122',
5fed29
+                   'SUBSYSTEM': 'block',
5fed29
+                   'SYSTEMD_WANTS': 'mdmonitor.service',
5fed29
+                   'TAGS': ':systemd:',
5fed29
+                   'USEC_INITIALIZED': '8770105',
5fed29
+                   'SYS_NAME': 'md122',
5fed29
+                   'SYS_PATH': '/sys/devices/virtual/block/md122'}
5fed29
+
5fed29
+    raid_partition = {'DEVLINKS': '/dev/disk/by-id/md-uuid-0628d995:eb60ebd1:a7675173:0b16f212-part1 /dev/disk/by-id/md-name-localhost.localdomain:122-part1 /dev/md/122p1',
5fed29
+                      'DEVNAME': '/dev/md122p1',
5fed29
+                      'DEVPATH': '/devices/virtual/block/md122/md122p1',
5fed29
+                      'DEVTYPE': 'partition',
5fed29
+                      'ID_PART_ENTRY_DISK': '9:122',
5fed29
+                      'ID_PART_ENTRY_NUMBER': '1',
5fed29
+                      'ID_PART_ENTRY_OFFSET': '2048',
5fed29
+                      'ID_PART_ENTRY_SCHEME': 'dos',
5fed29
+                      'ID_PART_ENTRY_SIZE': '200704',
5fed29
+                      'ID_PART_ENTRY_TYPE': '0x83',
5fed29
+                      'ID_PART_ENTRY_UUID': '6dc80b3b-01',
5fed29
+                      'MAJOR': '259',
5fed29
+                      'MD_DEVICES': '2',
5fed29
+                      'MD_DEVICE_ev_sdh3_DEV': '/dev/sdh3',
5fed29
+                      'MD_DEVICE_ev_sdh3_ROLE': '0',
5fed29
+                      'MD_DEVICE_ev_sdh5_DEV': '/dev/sdh5',
5fed29
+                      'MD_DEVICE_ev_sdh5_ROLE': '1',
5fed29
+                      'MD_DEVNAME': '122',
5fed29
+                      'MD_LEVEL': 'raid1',
5fed29
+                      'MD_METADATA': '1.2',
5fed29
+                      'MD_NAME': 'localhost.localdomain:122',
5fed29
+                      'MD_UUID': '0628d995:eb60ebd1:a7675173:0b16f212',
5fed29
+                      'MINOR': '6',
5fed29
+                      'PARTN': '1',
5fed29
+                      'SUBSYSTEM': 'block',
5fed29
+                      'SYSTEMD_WANTS': 'mdmonitor.service',
5fed29
+                      'TAGS': ':systemd:',
5fed29
+                      'USEC_INITIALIZED': '9003885',
5fed29
+                      'SYS_NAME': 'md122p1',
5fed29
+                      'SYS_PATH': '/sys/devices/virtual/block/md122/md122p1'}
5fed29
+
5fed29
+
5fed29
+class RaidOnPartition2():
5fed29
+    member_name = "sdh1"
5fed29
+    raid_name = "123"
5fed29
+    raid_node = "md123"
5fed29
+    metadata_version = "0.9"
5fed29
+
5fed29
+    member_boot = {'DEVLINKS': '/dev/disk/by-path/pci-0000:00:07.0-scsi-0:0:2:0-part1 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi1-0-2-part1 /dev/disk/by-partuuid/73eb11a9-01',
5fed29
+                   'DEVNAME': '/dev/sdh1',
5fed29
+                   'DEVPATH': '/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh1',
5fed29
+                   'DEVTYPE': 'partition',
5fed29
+                   'ID_BUS': 'scsi',
5fed29
+                   'ID_FS_TYPE': 'linux_raid_member',
5fed29
+                   'ID_FS_USAGE': 'raid',
5fed29
+                   'ID_FS_UUID': '335b35e0-f1af-8e86-bfe7-8010bc810f04',
5fed29
+                   'ID_FS_UUID_ENC': '335b35e0-f1af-8e86-bfe7-8010bc810f04',
5fed29
+                   'ID_FS_VERSION': '0.90.0',
5fed29
+                   'ID_MODEL': 'QEMU_HARDDISK',
5fed29
+                   'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20',
5fed29
+                   'ID_PART_ENTRY_DISK': '8:112',
5fed29
+                   'ID_PART_ENTRY_NUMBER': '1',
5fed29
+                   'ID_PART_ENTRY_OFFSET': '2048',
5fed29
+                   'ID_PART_ENTRY_SCHEME': 'dos',
5fed29
+                   'ID_PART_ENTRY_SIZE': '204800',
5fed29
+                   'ID_PART_ENTRY_TYPE': '0x83',
5fed29
+                   'ID_PART_ENTRY_UUID': '73eb11a9-01',
5fed29
+                   'ID_PART_TABLE_TYPE': 'dos',
5fed29
+                   'ID_PART_TABLE_UUID': '73eb11a9',
5fed29
+                   'ID_PATH': 'pci-0000:00:07.0-scsi-0:0:2:0',
5fed29
+                   'ID_PATH_TAG': 'pci-0000_00_07_0-scsi-0_0_2_0',
5fed29
+                   'ID_REVISION': '2.5+',
5fed29
+                   'ID_SCSI': '1',
5fed29
+                   'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi1-0-2',
5fed29
+                   'ID_SERIAL_SHORT': 'drive-scsi1-0-2',
5fed29
+                   'ID_TYPE': 'disk',
5fed29
+                   'ID_VENDOR': 'QEMU',
5fed29
+                   'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20',
5fed29
+                   'MAJOR': '8',
5fed29
+                   'MD_DEVICE': 'md123',
5fed29
+                   'MD_DEVNAME': '123',
5fed29
+                   'MD_FOREIGN': 'no',
5fed29
+                   'MD_STARTED': 'unsafe',
5fed29
+                   'MINOR': '113',
5fed29
+                   'PARTN': '1',
5fed29
+                   'SUBSYSTEM': 'block',
5fed29
+                   'SYSTEMD_WANTS': 'mdadm-last-resort@md123.timer',
5fed29
+                   'TAGS': ':systemd:',
5fed29
+                   'USEC_INITIALIZED': '8778733',
5fed29
+                   'SYS_NAME': 'sdh1',
5fed29
+                   'SYS_PATH': '/sys/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh1'}
5fed29
+
5fed29
+    member_assemble = {'DEVLINKS': '/dev/disk/by-path/pci-0000:00:07.0-scsi-0:0:2:0-part1 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi1-0-2-part1 /dev/disk/by-partuuid/73eb11a9-01',
5fed29
+                       'DEVNAME': '/dev/sdh1',
5fed29
+                       'DEVPATH': '/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh1',
5fed29
+                       'DEVTYPE': 'partition',
5fed29
+                       'ID_BUS': 'scsi',
5fed29
+                       'ID_FS_TYPE': 'linux_raid_member',
5fed29
+                       'ID_FS_USAGE': 'raid',
5fed29
+                       'ID_FS_UUID': '335b35e0-f1af-8e86-bfe7-8010bc810f04',
5fed29
+                       'ID_FS_UUID_ENC': '335b35e0-f1af-8e86-bfe7-8010bc810f04',
5fed29
+                       'ID_FS_VERSION': '0.90.0',
5fed29
+                       'ID_MODEL': 'QEMU_HARDDISK',
5fed29
+                       'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20',
5fed29
+                       'ID_PART_ENTRY_DISK': '8:112',
5fed29
+                       'ID_PART_ENTRY_NUMBER': '1',
5fed29
+                       'ID_PART_ENTRY_OFFSET': '2048',
5fed29
+                       'ID_PART_ENTRY_SCHEME': 'dos',
5fed29
+                       'ID_PART_ENTRY_SIZE': '204800',
5fed29
+                       'ID_PART_ENTRY_TYPE': '0x83',
5fed29
+                       'ID_PART_ENTRY_UUID': '73eb11a9-01',
5fed29
+                       'ID_PART_TABLE_TYPE': 'dos',
5fed29
+                       'ID_PART_TABLE_UUID': '73eb11a9',
5fed29
+                       'ID_PATH': 'pci-0000:00:07.0-scsi-0:0:2:0',
5fed29
+                       'ID_PATH_TAG': 'pci-0000_00_07_0-scsi-0_0_2_0',
5fed29
+                       'ID_REVISION': '2.5+',
5fed29
+                       'ID_SCSI': '1',
5fed29
+                       'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi1-0-2',
5fed29
+                       'ID_SERIAL_SHORT': 'drive-scsi1-0-2',
5fed29
+                       'ID_TYPE': 'disk',
5fed29
+                       'ID_VENDOR': 'QEMU',
5fed29
+                       'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20',
5fed29
+                       'MAJOR': '8',
5fed29
+                       'MINOR': '113',
5fed29
+                       'PARTN': '1',
5fed29
+                       'SUBSYSTEM': 'block',
5fed29
+                       'TAGS': ':systemd:',
5fed29
+                       'UDISKS_MD_MEMBER_DEVICES': '2',
5fed29
+                       'UDISKS_MD_MEMBER_EVENTS': '18',
5fed29
+                       'UDISKS_MD_MEMBER_LEVEL': 'raid1',
5fed29
+                       'UDISKS_MD_MEMBER_UPDATE_TIME': '1597143914',
5fed29
+                       'UDISKS_MD_MEMBER_UUID': '335b35e0:f1af8e86:bfe78010:bc810f04',
5fed29
+                       'USEC_INITIALIZED': '8778733',
5fed29
+                       'SYS_NAME': 'sdh1',
5fed29
+                       'SYS_PATH': '/sys/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh1'}
5fed29
+
5fed29
+    raid_device = {'DEVLINKS': '/dev/md/123 /dev/disk/by-id/md-uuid-335b35e0:f1af8e86:bfe78010:bc810f04',
5fed29
+                   'DEVNAME': '/dev/md123',
5fed29
+                   'DEVPATH': '/devices/virtual/block/md123',
5fed29
+                   'DEVTYPE': 'disk',
5fed29
+                   'ID_PART_TABLE_TYPE': 'dos',
5fed29
+                   'ID_PART_TABLE_UUID': '653f84c8',
5fed29
+                   'MAJOR': '9',
5fed29
+                   'MD_DEVICES': '2',
5fed29
+                   'MD_DEVICE_ev_sdh1_DEV': '/dev/sdh1',
5fed29
+                   'MD_DEVICE_ev_sdh1_ROLE': '0',
5fed29
+                   'MD_DEVICE_ev_sdh2_DEV': '/dev/sdh2',
5fed29
+                   'MD_DEVICE_ev_sdh2_ROLE': '1',
5fed29
+                   'MD_DEVNAME': '123',
5fed29
+                   'MD_LEVEL': 'raid1',
5fed29
+                   'MD_METADATA': '0.90',
5fed29
+                   'MD_UUID': '335b35e0:f1af8e86:bfe78010:bc810f04',
5fed29
+                   'MINOR': '123',
5fed29
+                   'SUBSYSTEM': 'block',
5fed29
+                   'SYSTEMD_WANTS': 'mdmonitor.service',
5fed29
+                   'TAGS': ':systemd:',
5fed29
+                   'USEC_INITIALIZED': '8760382',
5fed29
+                   'SYS_NAME': 'md123',
5fed29
+                   'SYS_PATH': '/sys/devices/virtual/block/md123'}
5fed29
+
5fed29
+    raid_partition = {'DEVLINKS': '/dev/disk/by-id/md-uuid-335b35e0:f1af8e86:bfe78010:bc810f04-part1 /dev/md/123p1',
5fed29
+                      'DEVNAME': '/dev/md123p1',
5fed29
+                      'DEVPATH': '/devices/virtual/block/md123/md123p1',
5fed29
+                      'DEVTYPE': 'partition',
5fed29
+                      'ID_PART_ENTRY_DISK': '9:123',
5fed29
+                      'ID_PART_ENTRY_NUMBER': '1',
5fed29
+                      'ID_PART_ENTRY_OFFSET': '2048',
5fed29
+                      'ID_PART_ENTRY_SCHEME': 'dos',
5fed29
+                      'ID_PART_ENTRY_SIZE': '202624',
5fed29
+                      'ID_PART_ENTRY_TYPE': '0x83',
5fed29
+                      'ID_PART_ENTRY_UUID': '653f84c8-01',
5fed29
+                      'MAJOR': '259',
5fed29
+                      'MD_DEVICES': '2',
5fed29
+                      'MD_DEVICE_ev_sdh1_DEV': '/dev/sdh1',
5fed29
+                      'MD_DEVICE_ev_sdh1_ROLE': '0',
5fed29
+                      'MD_DEVICE_ev_sdh2_DEV': '/dev/sdh2',
5fed29
+                      'MD_DEVICE_ev_sdh2_ROLE': '1',
5fed29
+                      'MD_DEVNAME': '123',
5fed29
+                      'MD_LEVEL': 'raid1',
5fed29
+                      'MD_METADATA': '0.90',
5fed29
+                      'MD_UUID': '335b35e0:f1af8e86:bfe78010:bc810f04',
5fed29
+                      'MINOR': '5',
5fed29
+                      'PARTN': '1',
5fed29
+                      'SUBSYSTEM': 'block',
5fed29
+                      'SYSTEMD_WANTS': 'mdmonitor.service',
5fed29
+                      'TAGS': ':systemd:',
5fed29
+                      'USEC_INITIALIZED': '8952876',
5fed29
+                      'SYS_NAME': 'md123p1',
5fed29
+                      'SYS_PATH': '/sys/devices/virtual/block/md123/md123p1'}
5fed29
diff --git a/tests/udev_test.py b/tests/udev_test.py
5fed29
index 653eeb6d..d30a647b 100644
5fed29
--- a/tests/udev_test.py
5fed29
+++ b/tests/udev_test.py
5fed29
@@ -2,6 +2,8 @@
5fed29
 import unittest
5fed29
 import mock
5fed29
 
5fed29
+from udev_data import raid_data
5fed29
+
5fed29
 
5fed29
 class UdevTest(unittest.TestCase):
5fed29
 
5fed29
@@ -77,3 +79,47 @@ class UdevTest(unittest.TestCase):
5fed29
         # Normal MD RAID (w/ at least one non-disk member)
5fed29
         device_get_slaves.side_effect = lambda info: mixed_parents if info['SYS_PATH'] == mock.sentinel.md_path else list()
5fed29
         self.assertFalse(blivet.udev.device_is_disk(info))
5fed29
+
5fed29
+
5fed29
+class UdevGetNameRaidTest(unittest.TestCase):
5fed29
+
5fed29
+    def _test_raid_name(self, udev_data):
5fed29
+        import blivet.udev
5fed29
+
5fed29
+        # members don't have the device_get_sysfs_path(info) + "/md" folder
5fed29
+        with mock.patch("blivet.udev.device_is_md", return_value=False):
5fed29
+            member_name = blivet.udev.device_get_name(udev_data.member_boot)
5fed29
+            self.assertEqual(member_name, udev_data.member_name)
5fed29
+
5fed29
+            member_name = blivet.udev.device_get_name(udev_data.member_assemble)
5fed29
+            self.assertEqual(member_name, udev_data.member_name)
5fed29
+
5fed29
+        with mock.patch("blivet.udev.device_is_md", return_value=True):
5fed29
+            raid_name = blivet.udev.device_get_name(udev_data.raid_device)
5fed29
+            self.assertEqual(raid_name, udev_data.raid_name)
5fed29
+
5fed29
+        # partitions also don't have the device_get_sysfs_path(info) + "/md" folder
5fed29
+        with mock.patch("blivet.udev.device_is_md", return_value=False):
5fed29
+            part_name = blivet.udev.device_get_name(udev_data.raid_partition)
5fed29
+            expected_name = udev_data.raid_name + "p1" if udev_data.raid_name[-1].isdigit() else udev_data.raid_name + "1"
5fed29
+            self.assertEqual(part_name, expected_name)
5fed29
+
5fed29
+    def test_raid_name_on_disk_no_name(self):
5fed29
+        data = raid_data.RaidOnDisk1()
5fed29
+        self._test_raid_name(data)
5fed29
+
5fed29
+    def test_raid_name_on_disk__with_name(self):
5fed29
+        data = raid_data.RaidOnDisk2()
5fed29
+        self._test_raid_name(data)
5fed29
+
5fed29
+    def test_raid_name_on_disk_old_metadata(self):
5fed29
+        data = raid_data.RaidOnDisk3()
5fed29
+        self._test_raid_name(data)
5fed29
+
5fed29
+    def test_raid_name_on_part_no_name(self):
5fed29
+        data = raid_data.RaidOnPartition1()
5fed29
+        self._test_raid_name(data)
5fed29
+
5fed29
+    def test_raid_name_on_part_old_metadata(self):
5fed29
+        data = raid_data.RaidOnPartition2()
5fed29
+        self._test_raid_name(data)
5fed29
-- 
5fed29
2.25.4
5fed29