From 35c42dafe7ad72e69b4bf07394c33b76c1e8946f Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 21 2020 18:31:34 +0000 Subject: import python-blivet-3.2.2-6.el8 --- diff --git a/SOURCES/0010-Fix-name-resolution-for-MD-devices-and-partitions-on.patch b/SOURCES/0010-Fix-name-resolution-for-MD-devices-and-partitions-on.patch new file mode 100644 index 0000000..e94ba8e --- /dev/null +++ b/SOURCES/0010-Fix-name-resolution-for-MD-devices-and-partitions-on.patch @@ -0,0 +1,844 @@ +From 18ce766bc90abdf0d8ca54bdf578463392a52ee9 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 12 Aug 2020 10:57:19 +0200 +Subject: [PATCH 1/2] Fix name resolution for MD devices and partitions on them + +UDev data for both member disks/partitions and partitions on arrays +contain the MD_* properties we must be extra careful when deciding +what name we'll use for the device. + +Resolves: rhbz#1862904 +--- + blivet/udev.py | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/blivet/udev.py b/blivet/udev.py +index 41c99496..c85eb3dc 100644 +--- a/blivet/udev.py ++++ b/blivet/udev.py +@@ -202,9 +202,16 @@ def device_get_name(udev_info): + """ Return the best name for a device based on the udev db data. """ + if "DM_NAME" in udev_info: + name = udev_info["DM_NAME"] +- elif "MD_DEVNAME" in udev_info and os.path.exists(device_get_sysfs_path(udev_info) + "/md"): ++ elif "MD_DEVNAME" in udev_info: + mdname = udev_info["MD_DEVNAME"] +- if device_is_partition(udev_info): ++ if device_is_md(udev_info): ++ # MD RAID array -> use MD_DEVNAME ++ name = mdname ++ elif device_get_format(udev_info) == "linux_raid_member": ++ # MD RAID member -> use SYS_NAME ++ name = udev_info["SYS_NAME"] ++ elif device_is_partition(udev_info): ++ # partition on RAID -> construct name from MD_DEVNAME + partition number + # for partitions on named RAID we want to use the raid name, not + # the node, e.g. "raid1" instead of "md127p1" + partnum = udev_info["ID_PART_ENTRY_NUMBER"] +@@ -213,6 +220,7 @@ def device_get_name(udev_info): + else: + name = mdname + partnum + else: ++ # something else -> default to MD_DEVNAME + name = mdname + else: + name = udev_info["SYS_NAME"] +-- +2.25.4 + + +From dc96961adcb9dd6ef6d09e4daaa0a5eaae1ffe60 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 12 Aug 2020 11:10:03 +0200 +Subject: [PATCH 2/2] Add tests for udev.device_get_name for RAID devices + +This includes sample UDev data for various combinations of RAID +devices configuration. + +Related: rhbz#1862904 +--- + tests/udev_data/__init__.py | 0 + tests/udev_data/raid_data.py | 705 +++++++++++++++++++++++++++++++++++ + tests/udev_test.py | 46 +++ + 3 files changed, 751 insertions(+) + create mode 100644 tests/udev_data/__init__.py + create mode 100644 tests/udev_data/raid_data.py + +diff --git a/tests/udev_data/__init__.py b/tests/udev_data/__init__.py +new file mode 100644 +index 00000000..e69de29b +diff --git a/tests/udev_data/raid_data.py b/tests/udev_data/raid_data.py +new file mode 100644 +index 00000000..509cbfbd +--- /dev/null ++++ b/tests/udev_data/raid_data.py +@@ -0,0 +1,705 @@ ++# Sample UDev data for various MD RAID devices: ++# - member_boot: data for the member disk or partition after booting the system ++# - member_assemble: data for the member disk or partition after re-assembling stopped array using ++# 'mdadm --assemble --scan' (yes, this is different from member_boot) ++# - raid_device: data for the RAID array device ++# - raid_partition: data for partition on the array ++# ++# We have data for different combinations of member "types", MD metadata versions and named v unnamed ++# RAID devices. ++# The data were gathered on Fedora 32. ++ ++ ++class RaidOnDisk1(): ++ member_name = "sda" ++ raid_name = "127" ++ raid_node = "md127" ++ metadata_version = "1.2" ++ ++ 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', ++ 'DEVNAME': '/dev/sda', ++ 'DEVPATH': '/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:0/block/sda', ++ 'DEVTYPE': 'disk', ++ 'ID_BUS': 'scsi', ++ 'ID_FS_LABEL': 'localhost.localdomain:127', ++ 'ID_FS_LABEL_ENC': 'localhost.localdomain:127', ++ 'ID_FS_TYPE': 'linux_raid_member', ++ 'ID_FS_USAGE': 'raid', ++ 'ID_FS_UUID': '54956eb2-6983-8759-e2ad-4c40acc92e4b', ++ 'ID_FS_UUID_ENC': '54956eb2-6983-8759-e2ad-4c40acc92e4b', ++ 'ID_FS_UUID_SUB': '64f96f0b-e97c-9157-d393-1fe457f3dd59', ++ 'ID_FS_UUID_SUB_ENC': '64f96f0b-e97c-9157-d393-1fe457f3dd59', ++ 'ID_FS_VERSION': '1.2', ++ 'ID_MODEL': 'QEMU_HARDDISK', ++ 'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20', ++ 'ID_PATH': 'pci-0000:00:11.0-scsi-0:0:0:0', ++ 'ID_PATH_TAG': 'pci-0000_00_11_0-scsi-0_0_0_0', ++ 'ID_REVISION': '2.5+', ++ 'ID_SCSI': '1', ++ 'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0', ++ 'ID_SERIAL_SHORT': 'drive-scsi0-0-0-0', ++ 'ID_TYPE': 'disk', ++ 'ID_VENDOR': 'QEMU', ++ 'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20', ++ 'MAJOR': '8', ++ 'MD_DEVICE': 'md127', ++ 'MD_DEVNAME': '127', ++ 'MD_FOREIGN': 'no', ++ 'MD_STARTED': 'unsafe', ++ 'MINOR': '0', ++ 'SUBSYSTEM': 'block', ++ 'SYSTEMD_WANTS': 'mdadm-last-resort@md127.timer', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '5529231', ++ 'SYS_NAME': 'sda', ++ 'SYS_PATH': '/sys/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:0/block/sda'} ++ ++ 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', ++ 'DEVNAME': '/dev/sda', ++ 'DEVPATH': '/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:0/block/sda', ++ 'DEVTYPE': 'disk', ++ 'ID_BUS': 'scsi', ++ 'ID_FS_LABEL': 'localhost.localdomain:127', ++ 'ID_FS_LABEL_ENC': 'localhost.localdomain:127', ++ 'ID_FS_TYPE': 'linux_raid_member', ++ 'ID_FS_USAGE': 'raid', ++ 'ID_FS_UUID': '54956eb2-6983-8759-e2ad-4c40acc92e4b', ++ 'ID_FS_UUID_ENC': '54956eb2-6983-8759-e2ad-4c40acc92e4b', ++ 'ID_FS_UUID_SUB': '64f96f0b-e97c-9157-d393-1fe457f3dd59', ++ 'ID_FS_UUID_SUB_ENC': '64f96f0b-e97c-9157-d393-1fe457f3dd59', ++ 'ID_FS_VERSION': '1.2', ++ 'ID_MODEL': 'QEMU_HARDDISK', ++ 'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20', ++ 'ID_PATH': 'pci-0000:00:11.0-scsi-0:0:0:0', ++ 'ID_PATH_TAG': 'pci-0000_00_11_0-scsi-0_0_0_0', ++ 'ID_REVISION': '2.5+', ++ 'ID_SCSI': '1', ++ 'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0', ++ 'ID_SERIAL_SHORT': 'drive-scsi0-0-0-0', ++ 'ID_TYPE': 'disk', ++ 'ID_VENDOR': 'QEMU', ++ 'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20', ++ 'MAJOR': '8', ++ 'MINOR': '0', ++ 'SUBSYSTEM': 'block', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '5529231', ++ 'SYS_NAME': 'sda', ++ 'SYS_PATH': '/sys/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:0/block/sda'} ++ ++ 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', ++ 'DEVNAME': '/dev/md127', ++ 'DEVPATH': '/devices/virtual/block/md127', ++ 'DEVTYPE': 'disk', ++ 'ID_PART_TABLE_TYPE': 'dos', ++ 'ID_PART_TABLE_UUID': '4eec0361', ++ 'MAJOR': '9', ++ 'MD_DEVICES': '2', ++ 'MD_DEVICE_ev_sda_DEV': '/dev/sda', ++ 'MD_DEVICE_ev_sda_ROLE': '0', ++ 'MD_DEVICE_ev_sdb_DEV': '/dev/sdb', ++ 'MD_DEVICE_ev_sdb_ROLE': '1', ++ 'MD_DEVNAME': '127', ++ 'MD_LEVEL': 'raid1', ++ 'MD_METADATA': '1.2', ++ 'MD_NAME': 'localhost.localdomain:127', ++ 'MD_UUID': '54956eb2:69838759:e2ad4c40:acc92e4b', ++ 'MINOR': '127', ++ 'SUBSYSTEM': 'block', ++ 'SYSTEMD_WANTS': 'mdmonitor.service', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '603606045', ++ 'SYS_NAME': 'md127', ++ 'SYS_PATH': '/sys/devices/virtual/block/md127'} ++ ++ 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', ++ 'DEVNAME': '/dev/md127p1', ++ 'DEVPATH': '/devices/virtual/block/md127/md127p1', ++ 'DEVTYPE': 'partition', ++ 'ID_PART_ENTRY_DISK': '9:127', ++ 'ID_PART_ENTRY_NUMBER': '1', ++ 'ID_PART_ENTRY_OFFSET': '2048', ++ 'ID_PART_ENTRY_SCHEME': 'dos', ++ 'ID_PART_ENTRY_SIZE': '2091008', ++ 'ID_PART_ENTRY_TYPE': '0x83', ++ 'ID_PART_ENTRY_UUID': '4eec0361-01', ++ 'MAJOR': '259', ++ 'MD_DEVICES': '2', ++ 'MD_DEVICE_ev_sda_DEV': '/dev/sda', ++ 'MD_DEVICE_ev_sda_ROLE': '0', ++ 'MD_DEVICE_ev_sdb_DEV': '/dev/sdb', ++ 'MD_DEVICE_ev_sdb_ROLE': '1', ++ 'MD_DEVNAME': '127', ++ 'MD_LEVEL': 'raid1', ++ 'MD_METADATA': '1.2', ++ 'MD_NAME': 'localhost.localdomain:127', ++ 'MD_UUID': '54956eb2:69838759:e2ad4c40:acc92e4b', ++ 'MINOR': '2', ++ 'PARTN': '1', ++ 'SUBSYSTEM': 'block', ++ 'SYSTEMD_WANTS': 'mdmonitor.service', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '603714783', ++ 'SYS_NAME': 'md127p1', ++ 'SYS_PATH': '/sys/devices/virtual/block/md127/md127p1'} ++ ++ ++class RaidOnDisk2(): ++ member_name = "sdc" ++ raid_name = "name" ++ raid_node = "md127" ++ metadata_version = "1.2" ++ ++ 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', ++ 'DEVNAME': '/dev/sdc', ++ 'DEVPATH': '/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:4/block/sdc', ++ 'DEVTYPE': 'disk', ++ 'ID_BUS': 'scsi', ++ 'ID_FS_LABEL': 'localhost.localdomain:name', ++ 'ID_FS_LABEL_ENC': 'localhost.localdomain:name', ++ 'ID_FS_TYPE': 'linux_raid_member', ++ 'ID_FS_USAGE': 'raid', ++ 'ID_FS_UUID': '143d480c-12c3-909f-5476-98a9f94a1c4f', ++ 'ID_FS_UUID_ENC': '143d480c-12c3-909f-5476-98a9f94a1c4f', ++ 'ID_FS_UUID_SUB': '121f2b71-3634-4183-dc9c-08bfceda765c', ++ 'ID_FS_UUID_SUB_ENC': '121f2b71-3634-4183-dc9c-08bfceda765c', ++ 'ID_FS_VERSION': '1.2', ++ 'ID_MODEL': 'QEMU_HARDDISK', ++ 'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20', ++ 'ID_PATH': 'pci-0000:00:11.0-scsi-0:0:0:4', ++ 'ID_PATH_TAG': 'pci-0000_00_11_0-scsi-0_0_0_4', ++ 'ID_REVISION': '2.5+', ++ 'ID_SCSI': '1', ++ 'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-4', ++ 'ID_SERIAL_SHORT': 'drive-scsi0-0-0-4', ++ 'ID_TYPE': 'disk', ++ 'ID_VENDOR': 'QEMU', ++ 'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20', ++ 'MAJOR': '8', ++ 'MD_DEVICE': 'md127', ++ 'MD_DEVNAME': 'name', ++ 'MD_FOREIGN': 'no', ++ 'MD_STARTED': 'yes', ++ 'MINOR': '32', ++ 'SUBSYSTEM': 'block', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '6109555', ++ 'SYS_NAME': 'sdc', ++ 'SYS_PATH': '/sys/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:4/block/sdc'} ++ ++ 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', ++ 'DEVNAME': '/dev/sdc', ++ 'DEVPATH': '/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:4/block/sdc', ++ 'DEVTYPE': 'disk', ++ 'ID_BUS': 'scsi', ++ 'ID_FS_LABEL': 'localhost.localdomain:name', ++ 'ID_FS_LABEL_ENC': 'localhost.localdomain:name', ++ 'ID_FS_TYPE': 'linux_raid_member', ++ 'ID_FS_USAGE': 'raid', ++ 'ID_FS_UUID': '143d480c-12c3-909f-5476-98a9f94a1c4f', ++ 'ID_FS_UUID_ENC': '143d480c-12c3-909f-5476-98a9f94a1c4f', ++ 'ID_FS_UUID_SUB': '121f2b71-3634-4183-dc9c-08bfceda765c', ++ 'ID_FS_UUID_SUB_ENC': '121f2b71-3634-4183-dc9c-08bfceda765c', ++ 'ID_FS_VERSION': '1.2', ++ 'ID_MODEL': 'QEMU_HARDDISK', ++ 'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20', ++ 'ID_PATH': 'pci-0000:00:11.0-scsi-0:0:0:4', ++ 'ID_PATH_TAG': 'pci-0000_00_11_0-scsi-0_0_0_4', ++ 'ID_REVISION': '2.5+', ++ 'ID_SCSI': '1', ++ 'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-4', ++ 'ID_SERIAL_SHORT': 'drive-scsi0-0-0-4', ++ 'ID_TYPE': 'disk', ++ 'ID_VENDOR': 'QEMU', ++ 'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20', ++ 'MAJOR': '8', ++ 'MINOR': '32', ++ 'SUBSYSTEM': 'block', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '6109555', ++ 'SYS_NAME': 'sdc', ++ 'SYS_PATH': '/sys/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:4/block/sdc'} ++ ++ 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', ++ 'DEVNAME': '/dev/md127', ++ 'DEVPATH': '/devices/virtual/block/md127', ++ 'DEVTYPE': 'disk', ++ 'ID_PART_TABLE_TYPE': 'dos', ++ 'ID_PART_TABLE_UUID': '19e9cb5b', ++ 'MAJOR': '9', ++ 'MD_DEVICES': '2', ++ 'MD_DEVICE_ev_sdc_DEV': '/dev/sdc', ++ 'MD_DEVICE_ev_sdc_ROLE': '0', ++ 'MD_DEVICE_ev_sdd_DEV': '/dev/sdd', ++ 'MD_DEVICE_ev_sdd_ROLE': '1', ++ 'MD_DEVNAME': 'name', ++ 'MD_LEVEL': 'raid1', ++ 'MD_METADATA': '1.2', ++ 'MD_NAME': 'localhost.localdomain:name', ++ 'MD_UUID': '143d480c:12c3909f:547698a9:f94a1c4f', ++ 'MINOR': '127', ++ 'SUBSYSTEM': 'block', ++ 'SYSTEMD_WANTS': 'mdmonitor.service', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '5844744', ++ 'SYS_NAME': 'md127', ++ 'SYS_PATH': '/sys/devices/virtual/block/md127'} ++ ++ 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', ++ 'DEVNAME': '/dev/md127p1', ++ 'DEVPATH': '/devices/virtual/block/md127/md127p1', ++ 'DEVTYPE': 'partition', ++ 'ID_PART_ENTRY_DISK': '9:127', ++ 'ID_PART_ENTRY_NUMBER': '1', ++ 'ID_PART_ENTRY_OFFSET': '2048', ++ 'ID_PART_ENTRY_SCHEME': 'dos', ++ 'ID_PART_ENTRY_SIZE': '2091008', ++ 'ID_PART_ENTRY_TYPE': '0x83', ++ 'ID_PART_ENTRY_UUID': '19e9cb5b-01', ++ 'ID_PART_TABLE_TYPE': 'dos', ++ 'ID_PART_TABLE_UUID': 'ec985633', ++ 'MAJOR': '259', ++ 'MD_DEVICES': '2', ++ 'MD_DEVICE_ev_sdc_DEV': '/dev/sdc', ++ 'MD_DEVICE_ev_sdc_ROLE': '0', ++ 'MD_DEVICE_ev_sdd_DEV': '/dev/sdd', ++ 'MD_DEVICE_ev_sdd_ROLE': '1', ++ 'MD_DEVNAME': 'name', ++ 'MD_LEVEL': 'raid1', ++ 'MD_METADATA': '1.2', ++ 'MD_NAME': 'localhost.localdomain:name', ++ 'MD_UUID': '143d480c:12c3909f:547698a9:f94a1c4f', ++ 'MINOR': '1', ++ 'PARTN': '1', ++ 'SUBSYSTEM': 'block', ++ 'SYSTEMD_WANTS': 'mdmonitor.service', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '5928255', ++ 'SYS_NAME': 'md127p1', ++ 'SYS_PATH': '/sys/devices/virtual/block/md127/md127p1'} ++ ++ ++class RaidOnDisk3(): ++ member_name = "sde" ++ raid_name = "125" ++ raid_node = "md125" ++ metadata_version = "0.9" ++ ++ 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', ++ 'DEVNAME': '/dev/sde', ++ 'DEVPATH': '/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:1/block/sde', ++ 'DEVTYPE': 'disk', ++ 'ID_BUS': 'scsi', ++ 'ID_FS_TYPE': 'linux_raid_member', ++ 'ID_FS_USAGE': 'raid', ++ 'ID_FS_UUID': 'c4ef60f5-e374-5f70-bfe7-8010bc810f04', ++ 'ID_FS_UUID_ENC': 'c4ef60f5-e374-5f70-bfe7-8010bc810f04', ++ 'ID_FS_VERSION': '0.90.0', ++ 'ID_MODEL': 'QEMU_HARDDISK', ++ 'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20', ++ 'ID_PATH': 'pci-0000:00:11.0-scsi-0:0:0:1', ++ 'ID_PATH_TAG': 'pci-0000_00_11_0-scsi-0_0_0_1', ++ 'ID_REVISION': '2.5+', ++ 'ID_SCSI': '1', ++ 'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-1', ++ 'ID_SERIAL_SHORT': 'drive-scsi0-0-0-1', ++ 'ID_TYPE': 'disk', ++ 'ID_VENDOR': 'QEMU', ++ 'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20', ++ 'MAJOR': '8', ++ 'MD_DEVICE': 'md125', ++ 'MD_DEVNAME': '125', ++ 'MD_FOREIGN': 'no', ++ 'MD_STARTED': 'unsafe', ++ 'MINOR': '64', ++ 'SUBSYSTEM': 'block', ++ 'SYSTEMD_WANTS': 'mdadm-last-resort@md125.timer', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '5538551', ++ 'SYS_NAME': 'sde', ++ 'SYS_PATH': '/sys/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:1/block/sde'} ++ ++ 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', ++ 'DEVNAME': '/dev/sde', ++ 'DEVPATH': '/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:1/block/sde', ++ 'DEVTYPE': 'disk', ++ 'ID_BUS': 'scsi', ++ 'ID_FS_TYPE': 'linux_raid_member', ++ 'ID_FS_USAGE': 'raid', ++ 'ID_FS_UUID': 'c4ef60f5-e374-5f70-bfe7-8010bc810f04', ++ 'ID_FS_UUID_ENC': 'c4ef60f5-e374-5f70-bfe7-8010bc810f04', ++ 'ID_FS_VERSION': '0.90.0', ++ 'ID_MODEL': 'QEMU_HARDDISK', ++ 'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20', ++ 'ID_PATH': 'pci-0000:00:11.0-scsi-0:0:0:1', ++ 'ID_PATH_TAG': 'pci-0000_00_11_0-scsi-0_0_0_1', ++ 'ID_REVISION': '2.5+', ++ 'ID_SCSI': '1', ++ 'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-1', ++ 'ID_SERIAL_SHORT': 'drive-scsi0-0-0-1', ++ 'ID_TYPE': 'disk', ++ 'ID_VENDOR': 'QEMU', ++ 'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20', ++ 'MAJOR': '8', ++ 'MINOR': '64', ++ 'SUBSYSTEM': 'block', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '5538551', ++ 'SYS_NAME': 'sde', ++ 'SYS_PATH': '/sys/devices/pci0000:00/0000:00:11.0/virtio5/host8/target8:0:0/8:0:0:1/block/sde'} ++ ++ raid_device = {'DEVLINKS': '/dev/md/125 /dev/disk/by-id/md-uuid-c4ef60f5:e3745f70:bfe78010:bc810f04', ++ 'DEVNAME': '/dev/md125', ++ 'DEVPATH': '/devices/virtual/block/md125', ++ 'DEVTYPE': 'disk', ++ 'ID_PART_TABLE_TYPE': 'dos', ++ 'ID_PART_TABLE_UUID': 'e74877cd', ++ 'MAJOR': '9', ++ 'MD_DEVICES': '2', ++ 'MD_DEVICE_ev_sde_DEV': '/dev/sde', ++ 'MD_DEVICE_ev_sde_ROLE': '0', ++ 'MD_DEVICE_ev_sdf_DEV': '/dev/sdf', ++ 'MD_DEVICE_ev_sdf_ROLE': '1', ++ 'MD_DEVNAME': '125', ++ 'MD_LEVEL': 'raid1', ++ 'MD_METADATA': '0.90', ++ 'MD_UUID': 'c4ef60f5:e3745f70:bfe78010:bc810f04', ++ 'MINOR': '125', ++ 'SUBSYSTEM': 'block', ++ 'SYSTEMD_WANTS': 'mdmonitor.service', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '5786380', ++ 'SYS_NAME': 'md125', ++ 'SYS_PATH': '/sys/devices/virtual/block/md125'} ++ ++ raid_partition = {'DEVLINKS': '/dev/md/125p1 /dev/disk/by-id/md-uuid-c4ef60f5:e3745f70:bfe78010:bc810f04-part1', ++ 'DEVNAME': '/dev/md125p1', ++ 'DEVPATH': '/devices/virtual/block/md125/md125p1', ++ 'DEVTYPE': 'partition', ++ 'ID_PART_ENTRY_DISK': '9:125', ++ 'ID_PART_ENTRY_NUMBER': '1', ++ 'ID_PART_ENTRY_OFFSET': '2048', ++ 'ID_PART_ENTRY_SCHEME': 'dos', ++ 'ID_PART_ENTRY_SIZE': '2094976', ++ 'ID_PART_ENTRY_TYPE': '0x83', ++ 'ID_PART_ENTRY_UUID': 'e74877cd-01', ++ 'MAJOR': '259', ++ 'MD_DEVICES': '2', ++ 'MD_DEVICE_ev_sde_DEV': '/dev/sde', ++ 'MD_DEVICE_ev_sde_ROLE': '0', ++ 'MD_DEVICE_ev_sdf_DEV': '/dev/sdf', ++ 'MD_DEVICE_ev_sdf_ROLE': '1', ++ 'MD_DEVNAME': '125', ++ 'MD_LEVEL': 'raid1', ++ 'MD_METADATA': '0.90', ++ 'MD_UUID': 'c4ef60f5:e3745f70:bfe78010:bc810f04', ++ 'MINOR': '3', ++ 'PARTN': '1', ++ 'SUBSYSTEM': 'block', ++ 'SYSTEMD_WANTS': 'mdmonitor.service', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '8808457', ++ 'SYS_NAME': 'md125p1', ++ 'SYS_PATH': '/sys/devices/virtual/block/md125/md125p1'} ++ ++ ++class RaidOnPartition1(): ++ member_name = "sdh3" ++ raid_name = "122" ++ raid_node = "md122" ++ metadata_version = "1.2" ++ ++ 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', ++ 'DEVNAME': '/dev/sdh3', ++ 'DEVPATH': '/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh3', ++ 'DEVTYPE': 'partition', ++ 'ID_BUS': 'scsi', ++ 'ID_FS_LABEL': 'localhost.localdomain:122', ++ 'ID_FS_LABEL_ENC': 'localhost.localdomain:122', ++ 'ID_FS_TYPE': 'linux_raid_member', ++ 'ID_FS_USAGE': 'raid', ++ 'ID_FS_UUID': '0628d995-eb60-ebd1-a767-51730b16f212', ++ 'ID_FS_UUID_ENC': '0628d995-eb60-ebd1-a767-51730b16f212', ++ 'ID_FS_UUID_SUB': 'b301779b-f759-ad7d-5324-b38d4b6d944d', ++ 'ID_FS_UUID_SUB_ENC': 'b301779b-f759-ad7d-5324-b38d4b6d944d', ++ 'ID_FS_VERSION': '1.2', ++ 'ID_MODEL': 'QEMU_HARDDISK', ++ 'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20', ++ 'ID_PART_ENTRY_DISK': '8:112', ++ 'ID_PART_ENTRY_NUMBER': '3', ++ 'ID_PART_ENTRY_OFFSET': '411648', ++ 'ID_PART_ENTRY_SCHEME': 'dos', ++ 'ID_PART_ENTRY_SIZE': '204800', ++ 'ID_PART_ENTRY_TYPE': '0x83', ++ 'ID_PART_ENTRY_UUID': '73eb11a9-03', ++ 'ID_PART_TABLE_TYPE': 'dos', ++ 'ID_PART_TABLE_UUID': '73eb11a9', ++ 'ID_PATH': 'pci-0000:00:07.0-scsi-0:0:2:0', ++ 'ID_PATH_TAG': 'pci-0000_00_07_0-scsi-0_0_2_0', ++ 'ID_REVISION': '2.5+', ++ 'ID_SCSI': '1', ++ 'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi1-0-2', ++ 'ID_SERIAL_SHORT': 'drive-scsi1-0-2', ++ 'ID_TYPE': 'disk', ++ 'ID_VENDOR': 'QEMU', ++ 'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20', ++ 'MAJOR': '8', ++ 'MD_DEVICE': 'md122', ++ 'MD_DEVNAME': '122', ++ 'MD_FOREIGN': 'no', ++ 'MD_STARTED': 'yes', ++ 'MINOR': '115', ++ 'PARTN': '3', ++ 'SUBSYSTEM': 'block', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '8920462', ++ 'SYS_NAME': 'sdh3', ++ 'SYS_PATH': '/sys/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh3'} ++ ++ 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', ++ 'DEVNAME': '/dev/sdh3', ++ 'DEVPATH': '/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh3', ++ 'DEVTYPE': 'partition', ++ 'ID_BUS': 'scsi', ++ 'ID_FS_LABEL': 'localhost.localdomain:122', ++ 'ID_FS_LABEL_ENC': 'localhost.localdomain:122', ++ 'ID_FS_TYPE': 'linux_raid_member', ++ 'ID_FS_USAGE': 'raid', ++ 'ID_FS_UUID': '0628d995-eb60-ebd1-a767-51730b16f212', ++ 'ID_FS_UUID_ENC': '0628d995-eb60-ebd1-a767-51730b16f212', ++ 'ID_FS_UUID_SUB': 'b301779b-f759-ad7d-5324-b38d4b6d944d', ++ 'ID_FS_UUID_SUB_ENC': 'b301779b-f759-ad7d-5324-b38d4b6d944d', ++ 'ID_FS_VERSION': '1.2', ++ 'ID_MODEL': 'QEMU_HARDDISK', ++ 'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20', ++ 'ID_PART_ENTRY_DISK': '8:112', ++ 'ID_PART_ENTRY_NUMBER': '3', ++ 'ID_PART_ENTRY_OFFSET': '411648', ++ 'ID_PART_ENTRY_SCHEME': 'dos', ++ 'ID_PART_ENTRY_SIZE': '204800', ++ 'ID_PART_ENTRY_TYPE': '0x83', ++ 'ID_PART_ENTRY_UUID': '73eb11a9-03', ++ 'ID_PART_TABLE_TYPE': 'dos', ++ 'ID_PART_TABLE_UUID': '73eb11a9', ++ 'ID_PATH': 'pci-0000:00:07.0-scsi-0:0:2:0', ++ 'ID_PATH_TAG': 'pci-0000_00_07_0-scsi-0_0_2_0', ++ 'ID_REVISION': '2.5+', ++ 'ID_SCSI': '1', ++ 'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi1-0-2', ++ 'ID_SERIAL_SHORT': 'drive-scsi1-0-2', ++ 'ID_TYPE': 'disk', ++ 'ID_VENDOR': 'QEMU', ++ 'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20', ++ 'MAJOR': '8', ++ 'MINOR': '115', ++ 'PARTN': '3', ++ 'SUBSYSTEM': 'block', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '8920462', ++ 'SYS_NAME': 'sdh3', ++ 'SYS_PATH': '/sys/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh3'} ++ ++ 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', ++ 'DEVNAME': '/dev/md122', ++ 'DEVPATH': '/devices/virtual/block/md122', ++ 'DEVTYPE': 'disk', ++ 'ID_PART_TABLE_TYPE': 'dos', ++ 'ID_PART_TABLE_UUID': '6dc80b3b', ++ 'MAJOR': '9', ++ 'MD_DEVICES': '2', ++ 'MD_DEVICE_ev_sdh3_DEV': '/dev/sdh3', ++ 'MD_DEVICE_ev_sdh3_ROLE': '0', ++ 'MD_DEVICE_ev_sdh5_DEV': '/dev/sdh5', ++ 'MD_DEVICE_ev_sdh5_ROLE': '1', ++ 'MD_DEVNAME': '122', ++ 'MD_LEVEL': 'raid1', ++ 'MD_METADATA': '1.2', ++ 'MD_NAME': 'localhost.localdomain:122', ++ 'MD_UUID': '0628d995:eb60ebd1:a7675173:0b16f212', ++ 'MINOR': '122', ++ 'SUBSYSTEM': 'block', ++ 'SYSTEMD_WANTS': 'mdmonitor.service', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '8770105', ++ 'SYS_NAME': 'md122', ++ 'SYS_PATH': '/sys/devices/virtual/block/md122'} ++ ++ 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', ++ 'DEVNAME': '/dev/md122p1', ++ 'DEVPATH': '/devices/virtual/block/md122/md122p1', ++ 'DEVTYPE': 'partition', ++ 'ID_PART_ENTRY_DISK': '9:122', ++ 'ID_PART_ENTRY_NUMBER': '1', ++ 'ID_PART_ENTRY_OFFSET': '2048', ++ 'ID_PART_ENTRY_SCHEME': 'dos', ++ 'ID_PART_ENTRY_SIZE': '200704', ++ 'ID_PART_ENTRY_TYPE': '0x83', ++ 'ID_PART_ENTRY_UUID': '6dc80b3b-01', ++ 'MAJOR': '259', ++ 'MD_DEVICES': '2', ++ 'MD_DEVICE_ev_sdh3_DEV': '/dev/sdh3', ++ 'MD_DEVICE_ev_sdh3_ROLE': '0', ++ 'MD_DEVICE_ev_sdh5_DEV': '/dev/sdh5', ++ 'MD_DEVICE_ev_sdh5_ROLE': '1', ++ 'MD_DEVNAME': '122', ++ 'MD_LEVEL': 'raid1', ++ 'MD_METADATA': '1.2', ++ 'MD_NAME': 'localhost.localdomain:122', ++ 'MD_UUID': '0628d995:eb60ebd1:a7675173:0b16f212', ++ 'MINOR': '6', ++ 'PARTN': '1', ++ 'SUBSYSTEM': 'block', ++ 'SYSTEMD_WANTS': 'mdmonitor.service', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '9003885', ++ 'SYS_NAME': 'md122p1', ++ 'SYS_PATH': '/sys/devices/virtual/block/md122/md122p1'} ++ ++ ++class RaidOnPartition2(): ++ member_name = "sdh1" ++ raid_name = "123" ++ raid_node = "md123" ++ metadata_version = "0.9" ++ ++ 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', ++ 'DEVNAME': '/dev/sdh1', ++ 'DEVPATH': '/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh1', ++ 'DEVTYPE': 'partition', ++ 'ID_BUS': 'scsi', ++ 'ID_FS_TYPE': 'linux_raid_member', ++ 'ID_FS_USAGE': 'raid', ++ 'ID_FS_UUID': '335b35e0-f1af-8e86-bfe7-8010bc810f04', ++ 'ID_FS_UUID_ENC': '335b35e0-f1af-8e86-bfe7-8010bc810f04', ++ 'ID_FS_VERSION': '0.90.0', ++ 'ID_MODEL': 'QEMU_HARDDISK', ++ 'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20', ++ 'ID_PART_ENTRY_DISK': '8:112', ++ 'ID_PART_ENTRY_NUMBER': '1', ++ 'ID_PART_ENTRY_OFFSET': '2048', ++ 'ID_PART_ENTRY_SCHEME': 'dos', ++ 'ID_PART_ENTRY_SIZE': '204800', ++ 'ID_PART_ENTRY_TYPE': '0x83', ++ 'ID_PART_ENTRY_UUID': '73eb11a9-01', ++ 'ID_PART_TABLE_TYPE': 'dos', ++ 'ID_PART_TABLE_UUID': '73eb11a9', ++ 'ID_PATH': 'pci-0000:00:07.0-scsi-0:0:2:0', ++ 'ID_PATH_TAG': 'pci-0000_00_07_0-scsi-0_0_2_0', ++ 'ID_REVISION': '2.5+', ++ 'ID_SCSI': '1', ++ 'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi1-0-2', ++ 'ID_SERIAL_SHORT': 'drive-scsi1-0-2', ++ 'ID_TYPE': 'disk', ++ 'ID_VENDOR': 'QEMU', ++ 'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20', ++ 'MAJOR': '8', ++ 'MD_DEVICE': 'md123', ++ 'MD_DEVNAME': '123', ++ 'MD_FOREIGN': 'no', ++ 'MD_STARTED': 'unsafe', ++ 'MINOR': '113', ++ 'PARTN': '1', ++ 'SUBSYSTEM': 'block', ++ 'SYSTEMD_WANTS': 'mdadm-last-resort@md123.timer', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '8778733', ++ 'SYS_NAME': 'sdh1', ++ 'SYS_PATH': '/sys/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh1'} ++ ++ 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', ++ 'DEVNAME': '/dev/sdh1', ++ 'DEVPATH': '/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh1', ++ 'DEVTYPE': 'partition', ++ 'ID_BUS': 'scsi', ++ 'ID_FS_TYPE': 'linux_raid_member', ++ 'ID_FS_USAGE': 'raid', ++ 'ID_FS_UUID': '335b35e0-f1af-8e86-bfe7-8010bc810f04', ++ 'ID_FS_UUID_ENC': '335b35e0-f1af-8e86-bfe7-8010bc810f04', ++ 'ID_FS_VERSION': '0.90.0', ++ 'ID_MODEL': 'QEMU_HARDDISK', ++ 'ID_MODEL_ENC': 'QEMU\\x20HARDDISK\\x20\\x20\\x20', ++ 'ID_PART_ENTRY_DISK': '8:112', ++ 'ID_PART_ENTRY_NUMBER': '1', ++ 'ID_PART_ENTRY_OFFSET': '2048', ++ 'ID_PART_ENTRY_SCHEME': 'dos', ++ 'ID_PART_ENTRY_SIZE': '204800', ++ 'ID_PART_ENTRY_TYPE': '0x83', ++ 'ID_PART_ENTRY_UUID': '73eb11a9-01', ++ 'ID_PART_TABLE_TYPE': 'dos', ++ 'ID_PART_TABLE_UUID': '73eb11a9', ++ 'ID_PATH': 'pci-0000:00:07.0-scsi-0:0:2:0', ++ 'ID_PATH_TAG': 'pci-0000_00_07_0-scsi-0_0_2_0', ++ 'ID_REVISION': '2.5+', ++ 'ID_SCSI': '1', ++ 'ID_SERIAL': '0QEMU_QEMU_HARDDISK_drive-scsi1-0-2', ++ 'ID_SERIAL_SHORT': 'drive-scsi1-0-2', ++ 'ID_TYPE': 'disk', ++ 'ID_VENDOR': 'QEMU', ++ 'ID_VENDOR_ENC': 'QEMU\\x20\\x20\\x20\\x20', ++ 'MAJOR': '8', ++ 'MINOR': '113', ++ 'PARTN': '1', ++ 'SUBSYSTEM': 'block', ++ 'TAGS': ':systemd:', ++ 'UDISKS_MD_MEMBER_DEVICES': '2', ++ 'UDISKS_MD_MEMBER_EVENTS': '18', ++ 'UDISKS_MD_MEMBER_LEVEL': 'raid1', ++ 'UDISKS_MD_MEMBER_UPDATE_TIME': '1597143914', ++ 'UDISKS_MD_MEMBER_UUID': '335b35e0:f1af8e86:bfe78010:bc810f04', ++ 'USEC_INITIALIZED': '8778733', ++ 'SYS_NAME': 'sdh1', ++ 'SYS_PATH': '/sys/devices/pci0000:00/0000:00:07.0/host9/target9:0:2/9:0:2:0/block/sdh/sdh1'} ++ ++ raid_device = {'DEVLINKS': '/dev/md/123 /dev/disk/by-id/md-uuid-335b35e0:f1af8e86:bfe78010:bc810f04', ++ 'DEVNAME': '/dev/md123', ++ 'DEVPATH': '/devices/virtual/block/md123', ++ 'DEVTYPE': 'disk', ++ 'ID_PART_TABLE_TYPE': 'dos', ++ 'ID_PART_TABLE_UUID': '653f84c8', ++ 'MAJOR': '9', ++ 'MD_DEVICES': '2', ++ 'MD_DEVICE_ev_sdh1_DEV': '/dev/sdh1', ++ 'MD_DEVICE_ev_sdh1_ROLE': '0', ++ 'MD_DEVICE_ev_sdh2_DEV': '/dev/sdh2', ++ 'MD_DEVICE_ev_sdh2_ROLE': '1', ++ 'MD_DEVNAME': '123', ++ 'MD_LEVEL': 'raid1', ++ 'MD_METADATA': '0.90', ++ 'MD_UUID': '335b35e0:f1af8e86:bfe78010:bc810f04', ++ 'MINOR': '123', ++ 'SUBSYSTEM': 'block', ++ 'SYSTEMD_WANTS': 'mdmonitor.service', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '8760382', ++ 'SYS_NAME': 'md123', ++ 'SYS_PATH': '/sys/devices/virtual/block/md123'} ++ ++ raid_partition = {'DEVLINKS': '/dev/disk/by-id/md-uuid-335b35e0:f1af8e86:bfe78010:bc810f04-part1 /dev/md/123p1', ++ 'DEVNAME': '/dev/md123p1', ++ 'DEVPATH': '/devices/virtual/block/md123/md123p1', ++ 'DEVTYPE': 'partition', ++ 'ID_PART_ENTRY_DISK': '9:123', ++ 'ID_PART_ENTRY_NUMBER': '1', ++ 'ID_PART_ENTRY_OFFSET': '2048', ++ 'ID_PART_ENTRY_SCHEME': 'dos', ++ 'ID_PART_ENTRY_SIZE': '202624', ++ 'ID_PART_ENTRY_TYPE': '0x83', ++ 'ID_PART_ENTRY_UUID': '653f84c8-01', ++ 'MAJOR': '259', ++ 'MD_DEVICES': '2', ++ 'MD_DEVICE_ev_sdh1_DEV': '/dev/sdh1', ++ 'MD_DEVICE_ev_sdh1_ROLE': '0', ++ 'MD_DEVICE_ev_sdh2_DEV': '/dev/sdh2', ++ 'MD_DEVICE_ev_sdh2_ROLE': '1', ++ 'MD_DEVNAME': '123', ++ 'MD_LEVEL': 'raid1', ++ 'MD_METADATA': '0.90', ++ 'MD_UUID': '335b35e0:f1af8e86:bfe78010:bc810f04', ++ 'MINOR': '5', ++ 'PARTN': '1', ++ 'SUBSYSTEM': 'block', ++ 'SYSTEMD_WANTS': 'mdmonitor.service', ++ 'TAGS': ':systemd:', ++ 'USEC_INITIALIZED': '8952876', ++ 'SYS_NAME': 'md123p1', ++ 'SYS_PATH': '/sys/devices/virtual/block/md123/md123p1'} +diff --git a/tests/udev_test.py b/tests/udev_test.py +index 653eeb6d..d30a647b 100644 +--- a/tests/udev_test.py ++++ b/tests/udev_test.py +@@ -2,6 +2,8 @@ + import unittest + import mock + ++from udev_data import raid_data ++ + + class UdevTest(unittest.TestCase): + +@@ -77,3 +79,47 @@ class UdevTest(unittest.TestCase): + # Normal MD RAID (w/ at least one non-disk member) + device_get_slaves.side_effect = lambda info: mixed_parents if info['SYS_PATH'] == mock.sentinel.md_path else list() + self.assertFalse(blivet.udev.device_is_disk(info)) ++ ++ ++class UdevGetNameRaidTest(unittest.TestCase): ++ ++ def _test_raid_name(self, udev_data): ++ import blivet.udev ++ ++ # members don't have the device_get_sysfs_path(info) + "/md" folder ++ with mock.patch("blivet.udev.device_is_md", return_value=False): ++ member_name = blivet.udev.device_get_name(udev_data.member_boot) ++ self.assertEqual(member_name, udev_data.member_name) ++ ++ member_name = blivet.udev.device_get_name(udev_data.member_assemble) ++ self.assertEqual(member_name, udev_data.member_name) ++ ++ with mock.patch("blivet.udev.device_is_md", return_value=True): ++ raid_name = blivet.udev.device_get_name(udev_data.raid_device) ++ self.assertEqual(raid_name, udev_data.raid_name) ++ ++ # partitions also don't have the device_get_sysfs_path(info) + "/md" folder ++ with mock.patch("blivet.udev.device_is_md", return_value=False): ++ part_name = blivet.udev.device_get_name(udev_data.raid_partition) ++ expected_name = udev_data.raid_name + "p1" if udev_data.raid_name[-1].isdigit() else udev_data.raid_name + "1" ++ self.assertEqual(part_name, expected_name) ++ ++ def test_raid_name_on_disk_no_name(self): ++ data = raid_data.RaidOnDisk1() ++ self._test_raid_name(data) ++ ++ def test_raid_name_on_disk__with_name(self): ++ data = raid_data.RaidOnDisk2() ++ self._test_raid_name(data) ++ ++ def test_raid_name_on_disk_old_metadata(self): ++ data = raid_data.RaidOnDisk3() ++ self._test_raid_name(data) ++ ++ def test_raid_name_on_part_no_name(self): ++ data = raid_data.RaidOnPartition1() ++ self._test_raid_name(data) ++ ++ def test_raid_name_on_part_old_metadata(self): ++ data = raid_data.RaidOnPartition2() ++ self._test_raid_name(data) +-- +2.25.4 + diff --git a/SOURCES/0011-Fix-ignoring-disk-devices-with-parents-or-children.patch b/SOURCES/0011-Fix-ignoring-disk-devices-with-parents-or-children.patch new file mode 100644 index 0000000..6ce0a64 --- /dev/null +++ b/SOURCES/0011-Fix-ignoring-disk-devices-with-parents-or-children.patch @@ -0,0 +1,269 @@ +From f19140993e94be9e58c8a01c18f1907792f59927 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 5 Aug 2020 13:44:38 +0200 +Subject: [PATCH] Fix ignoring disk devices with parents or children + +For disk-like devices like multipath we should allow to ignore +these by simply ignoring the mpath device or by ignoring all of its +drives. + +- when ignoring the "mpatha" device we should also ignore "sda" and +"sdb" +- when ignoring both "sda" and "sdb" we should also ignore "mpatha" +- when ignoring only "sda" we should not ignore "mpatha" (we don't +want to deal with an "incomplete" multipath device in the tree) + +This is consistent with the existing behaviour when using exclusive +disks (or "ignoredisks --only-use" in kickstart). + +Resolves: rhbz#1866243 +--- + blivet/devicetree.py | 51 ++++++++----- + tests/devicetree_test.py | 157 ++++++++++++++++++++++++++++----------- + 2 files changed, 146 insertions(+), 62 deletions(-) + +diff --git a/blivet/devicetree.py b/blivet/devicetree.py +index 5cc360e1..2afb0d0e 100644 +--- a/blivet/devicetree.py ++++ b/blivet/devicetree.py +@@ -907,31 +907,48 @@ class DeviceTreeBase(object): + hidden.add_hook(new=False) + lvm.lvm_cc_removeFilterRejectRegexp(hidden.name) + ++ def _disk_in_taglist(self, disk, taglist): ++ # Taglist is a list containing mix of disk names and tags into which disk may belong. ++ # Check if it does. Raise ValueError if unknown tag is encountered. ++ if disk.name in taglist: ++ return True ++ tags = [t[1:] for t in taglist if t.startswith("@")] ++ for tag in tags: ++ if tag not in Tags.__members__: ++ raise ValueError("unknown ignoredisk tag '@%s' encountered" % tag) ++ if Tags(tag) in disk.tags: ++ return True ++ return False ++ + def _is_ignored_disk(self, disk): + """ Checks config for lists of exclusive and ignored disks + and returns if the given one should be ignored + """ +- +- def disk_in_taglist(disk, taglist): +- # Taglist is a list containing mix of disk names and tags into which disk may belong. +- # Check if it does. Raise ValueError if unknown tag is encountered. +- if disk.name in taglist: +- return True +- tags = [t[1:] for t in taglist if t.startswith("@")] +- for tag in tags: +- if tag not in Tags.__members__: +- raise ValueError("unknown ignoredisk tag '@%s' encountered" % tag) +- if Tags(tag) in disk.tags: +- return True +- return False +- +- return ((self.ignored_disks and disk_in_taglist(disk, self.ignored_disks)) or +- (self.exclusive_disks and not disk_in_taglist(disk, self.exclusive_disks))) ++ return ((self.ignored_disks and self._disk_in_taglist(disk, self.ignored_disks)) or ++ (self.exclusive_disks and not self._disk_in_taglist(disk, self.exclusive_disks))) + + def _hide_ignored_disks(self): + # hide any subtrees that begin with an ignored disk + for disk in [d for d in self._devices if d.is_disk]: +- if self._is_ignored_disk(disk): ++ is_ignored = self.ignored_disks and self._disk_in_taglist(disk, self.ignored_disks) ++ is_exclusive = self.exclusive_disks and self._disk_in_taglist(disk, self.exclusive_disks) ++ ++ if is_ignored: ++ if len(disk.children) == 1: ++ if not all(self._is_ignored_disk(d) for d in disk.children[0].parents): ++ raise DeviceTreeError("Including only a subset of raid/multipath member disks is not allowed.") ++ ++ # and also children like fwraid or mpath ++ self.hide(disk.children[0]) ++ ++ # this disk is ignored: ignore it and all it's potential parents ++ for p in disk.parents: ++ self.hide(p) ++ ++ # and finally hide the disk itself ++ self.hide(disk) ++ ++ if self.exclusive_disks and not is_exclusive: + ignored = True + # If the filter allows all members of a fwraid or mpath, the + # fwraid or mpath itself is implicitly allowed as well. I don't +diff --git a/tests/devicetree_test.py b/tests/devicetree_test.py +index a8f369cf..6032e7f6 100644 +--- a/tests/devicetree_test.py ++++ b/tests/devicetree_test.py +@@ -370,51 +370,6 @@ class DeviceTreeTestCase(unittest.TestCase): + self.assertTrue(sdb in tree.devices) + self.assertTrue(sdc in tree.devices) + +- # now test exclusive_disks special cases for multipath +- sda.format = get_format("multipath_member", exists=True) +- sdb.format = get_format("multipath_member", exists=True) +- sdc.format = get_format("multipath_member", exists=True) +- mpatha = MultipathDevice("mpatha", parents=[sda, sdb, sdc]) +- tree._add_device(mpatha) +- +- tree.ignored_disks = [] +- tree.exclusive_disks = ["mpatha"] +- +- with patch.object(tree, "hide") as hide: +- tree._hide_ignored_disks() +- self.assertFalse(hide.called) +- +- tree._hide_ignored_disks() +- self.assertTrue(sda in tree.devices) +- self.assertTrue(sdb in tree.devices) +- self.assertTrue(sdc in tree.devices) +- self.assertTrue(mpatha in tree.devices) +- +- # all members in exclusive_disks implies the mpath in exclusive_disks +- tree.exclusive_disks = ["sda", "sdb", "sdc"] +- with patch.object(tree, "hide") as hide: +- tree._hide_ignored_disks() +- self.assertFalse(hide.called) +- +- tree._hide_ignored_disks() +- self.assertTrue(sda in tree.devices) +- self.assertTrue(sdb in tree.devices) +- self.assertTrue(sdc in tree.devices) +- self.assertTrue(mpatha in tree.devices) +- +- tree.exclusive_disks = ["sda", "sdb"] +- with patch.object(tree, "hide") as hide: +- tree._hide_ignored_disks() +- hide.assert_any_call(mpatha) +- hide.assert_any_call(sdc) +- +- # verify that hide works as expected +- tree._hide_ignored_disks() +- self.assertTrue(sda in tree.devices) +- self.assertTrue(sdb in tree.devices) +- self.assertFalse(sdc in tree.devices) +- self.assertFalse(mpatha in tree.devices) +- + def test_get_related_disks(self): + tree = DeviceTree() + +@@ -447,3 +402,115 @@ class DeviceTreeTestCase(unittest.TestCase): + tree.unhide(sda) + self.assertEqual(tree.get_related_disks(sda), set([sda, sdb])) + self.assertEqual(tree.get_related_disks(sdb), set([sda, sdb])) ++ ++ ++class DeviceTreeIgnoredExclusiveMultipathTestCase(unittest.TestCase): ++ ++ def setUp(self): ++ self.tree = DeviceTree() ++ ++ self.sda = DiskDevice("sda") ++ self.sdb = DiskDevice("sdb") ++ self.sdc = DiskDevice("sdc") ++ ++ self.tree._add_device(self.sda) ++ self.tree._add_device(self.sdb) ++ self.tree._add_device(self.sdc) ++ ++ self.assertTrue(self.sda in self.tree.devices) ++ self.assertTrue(self.sdb in self.tree.devices) ++ self.assertTrue(self.sdc in self.tree.devices) ++ ++ # now test exclusive_disks special cases for multipath ++ self.sda.format = get_format("multipath_member", exists=True) ++ self.sdb.format = get_format("multipath_member", exists=True) ++ self.sdc.format = get_format("multipath_member", exists=True) ++ self.mpatha = MultipathDevice("mpatha", parents=[self.sda, self.sdb, self.sdc]) ++ self.tree._add_device(self.mpatha) ++ ++ def test_exclusive_disks_multipath_1(self): ++ # multipath is exclusive -> all disks should be exclusive ++ self.tree.ignored_disks = [] ++ self.tree.exclusive_disks = ["mpatha"] ++ ++ with patch.object(self.tree, "hide") as hide: ++ self.tree._hide_ignored_disks() ++ self.assertFalse(hide.called) ++ ++ self.tree._hide_ignored_disks() ++ self.assertTrue(self.sda in self.tree.devices) ++ self.assertTrue(self.sdb in self.tree.devices) ++ self.assertTrue(self.sdc in self.tree.devices) ++ self.assertTrue(self.mpatha in self.tree.devices) ++ ++ def test_exclusive_disks_multipath_2(self): ++ # all disks exclusive -> mpath should also be exclusive ++ self.tree.exclusive_disks = ["sda", "sdb", "sdc"] ++ with patch.object(self.tree, "hide") as hide: ++ self.tree._hide_ignored_disks() ++ self.assertFalse(hide.called) ++ ++ self.tree._hide_ignored_disks() ++ self.assertTrue(self.sda in self.tree.devices) ++ self.assertTrue(self.sdb in self.tree.devices) ++ self.assertTrue(self.sdc in self.tree.devices) ++ self.assertTrue(self.mpatha in self.tree.devices) ++ ++ def test_exclusive_disks_multipath_3(self): ++ # some disks exclusive -> mpath should be hidden ++ self.tree.exclusive_disks = ["sda", "sdb"] ++ with patch.object(self.tree, "hide") as hide: ++ self.tree._hide_ignored_disks() ++ hide.assert_any_call(self.mpatha) ++ hide.assert_any_call(self.sdc) ++ ++ # verify that hide works as expected ++ self.tree._hide_ignored_disks() ++ self.assertTrue(self.sda in self.tree.devices) ++ self.assertTrue(self.sdb in self.tree.devices) ++ self.assertFalse(self.sdc in self.tree.devices) ++ self.assertFalse(self.mpatha in self.tree.devices) ++ ++ def test_ignored_disks_multipath_1(self): ++ # mpatha ignored -> disks should be hidden ++ self.tree.ignored_disks = ["mpatha"] ++ self.tree.exclusive_disks = [] ++ ++ with patch.object(self.tree, "hide") as hide: ++ self.tree._hide_ignored_disks() ++ hide.assert_any_call(self.mpatha) ++ hide.assert_any_call(self.sda) ++ hide.assert_any_call(self.sdb) ++ hide.assert_any_call(self.sdc) ++ ++ self.tree._hide_ignored_disks() ++ self.assertFalse(self.sda in self.tree.devices) ++ self.assertFalse(self.sdb in self.tree.devices) ++ self.assertFalse(self.sdc in self.tree.devices) ++ self.assertFalse(self.mpatha in self.tree.devices) ++ ++ def test_ignored_disks_multipath_2(self): ++ # all disks ignored -> mpath should be hidden ++ self.tree.ignored_disks = ["sda", "sdb", "sdc"] ++ self.tree.exclusive_disks = [] ++ ++ with patch.object(self.tree, "hide") as hide: ++ self.tree._hide_ignored_disks() ++ hide.assert_any_call(self.mpatha) ++ hide.assert_any_call(self.sda) ++ hide.assert_any_call(self.sdb) ++ hide.assert_any_call(self.sdc) ++ ++ self.tree._hide_ignored_disks() ++ self.assertFalse(self.sda in self.tree.devices) ++ self.assertFalse(self.sdb in self.tree.devices) ++ self.assertFalse(self.sdc in self.tree.devices) ++ self.assertFalse(self.mpatha in self.tree.devices) ++ ++ def test_ignored_disks_multipath_3(self): ++ # some disks ignored -> error ++ self.tree.ignored_disks = ["sda", "sdb"] ++ self.tree.exclusive_disks = [] ++ ++ with self.assertRaises(DeviceTreeError): ++ self.tree._hide_ignored_disks() +-- +2.25.4 + diff --git a/SPECS/python-blivet.spec b/SPECS/python-blivet.spec index 272d5c6..da3276d 100644 --- a/SPECS/python-blivet.spec +++ b/SPECS/python-blivet.spec @@ -23,7 +23,7 @@ Version: 3.2.2 #%%global prerelease .b2 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 -Release: 5%{?prerelease}%{?dist} +Release: 6%{?prerelease}%{?dist} Epoch: 1 License: LGPLv2+ Group: System Environment/Libraries @@ -40,6 +40,8 @@ Patch5: 0006-Blivet-RHEL-8.3-localization-update.patch Patch6: 0007-Do-not-use-FSAVAIL-and-FSUSE-options-when-running-lsblk.patch Patch7: 0008-set-allowed-disk-labels-for-s390x-as-standard-ones-plus-dasd.patch Patch8: 0009-Do-not-use-BlockDev-utils_have_kernel_module-to-check-for-modules.patch +Patch9: 0010-Fix-name-resolution-for-MD-devices-and-partitions-on.patch +Patch10: 0011-Fix-ignoring-disk-devices-with-parents-or-children.patch # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). @@ -201,6 +203,12 @@ configuration. %endif %changelog +* Thu Aug 20 2020 Vojtech Trefny - 3.2.2-6 +- Fix name resolution for MD devices and partitions on them + Resolves: rhbz#1862904 +- Fix ignoring disk devices with parents or children + Resolves: rhbz#1866243 + * Thu Jul 16 2020 Vojtech Trefny - 3.2.2-5 - set allowed disk labels for s390x as standard ones (msdos + gpt) plus dasd Resolves: rhbz#1855200