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

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