Skip to content

Commit

Permalink
Fix udevadm.py to parser VRAID partition correctly (Bugfix) (#952)
Browse files Browse the repository at this point in the history
* Fix for VRAID

* Add the unit test data

* Reduce the input data size
  • Loading branch information
seankingyang authored Apr 11, 2024
1 parent 6e64f92 commit de07b8b
Show file tree
Hide file tree
Showing 3 changed files with 362 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,15 @@ def test_two_dms_one_with_ubutnu_save(self):
devices = self.parse("two_dms_one_with_ubuntu_save")
self.assertEqual(len(devices), 1)

def test_VRAID_machine(self):
"""
The machine with VRAID will have the different _stack length.
See: https://github.com/canonical/checkbox/issues/482
For details.
"""
devices = self.parse("With_VRAID", with_partitions=True)


def verify_devices(self, devices, expected_device_list):
"""
Verify we have the expected quantity of each device given in the list,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,349 @@
P: /devices/pci0000:6f/0000:6f:00.5/pci10001:80/10001:80:07.0
L: 0
E: DEVPATH=/devices/pci0000:6f/0000:6f:00.5/pci10001:80/10001:80:07.0
E: SUBSYSTEM=pci
E: DRIVER=pcieport
E: PCI_CLASS=60400
E: PCI_ID=8086:352D
E: PCI_SUBSYS_ID=8086:0000
E: PCI_SLOT_NAME=10001:80:07.0
E: MODALIAS=pci:v00008086d0000352Dsv00008086sd00000000bc06sc04i00
E: USEC_INITIALIZED=5668958
E: ID_PCI_CLASS_FROM_DATABASE=Bridge
E: ID_PCI_SUBCLASS_FROM_DATABASE=PCI bridge
E: ID_PCI_INTERFACE_FROM_DATABASE=Normal decode
E: ID_VENDOR_FROM_DATABASE=Intel Corporation

P: /devices/pci0000:6f/0000:6f:00.5/pci10001:80/10001:80:07.0/10001:84:00.0
L: 0
E: DEVPATH=/devices/pci0000:6f/0000:6f:00.5/pci10001:80/10001:80:07.0/10001:84:00.0
E: SUBSYSTEM=pci
E: DRIVER=nvme
E: PCI_CLASS=10802
E: PCI_ID=1C5C:1959
E: PCI_SUBSYS_ID=1C5C:1959
E: PCI_SLOT_NAME=10001:84:00.0
E: MODALIAS=pci:v00001C5Cd00001959sv00001C5Csd00001959bc01sc08i02
E: USEC_INITIALIZED=5683697
E: ID_PCI_CLASS_FROM_DATABASE=Mass storage controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Non-Volatile memory controller
E: ID_PCI_INTERFACE_FROM_DATABASE=NVM Express
E: ID_VENDOR_FROM_DATABASE=SK hynix

P: /devices/pci0000:6f/0000:6f:00.5/pci10001:80/10001:80:07.0/10001:84:00.0/nvme/nvme0
N: nvme0
L: 0
E: DEVPATH=/devices/pci0000:6f/0000:6f:00.5/pci10001:80/10001:80:07.0/10001:84:00.0/nvme/nvme0
E: SUBSYSTEM=nvme
E: DEVNAME=/dev/nvme0
E: NVME_TRTYPE=pcie
E: MAJOR=238
E: MINOR=0
E: USEC_INITIALIZED=5692947
E: ID_PCI_CLASS_FROM_DATABASE=Mass storage controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Non-Volatile memory controller
E: ID_PCI_INTERFACE_FROM_DATABASE=NVM Express
E: ID_VENDOR_FROM_DATABASE=SK hynix

P: /devices/pci0000:6f/0000:6f:00.5/pci10001:80/10001:80:07.0/10001:84:00.0/nvme/nvme0/nvme0n1
N: nvme0n1
L: 0
S: disk/by-id/nvme-PC801_NVMe_SK_hynix_1TB____SYBBN00931050BB0T
S: disk/by-path/pci-0000:6f:00.5-pci-10001:84:00.0-nvme-1
S: disk/by-id/nvme-eui.ace42e002b1446de2ee4ac0000000001
E: DEVPATH=/devices/pci0000:6f/0000:6f:00.5/pci10001:80/10001:80:07.0/10001:84:00.0/nvme/nvme0/nvme0n1
E: SUBSYSTEM=block
E: DEVNAME=/dev/nvme0n1
E: DEVTYPE=disk
E: DISKSEQ=13
E: MAJOR=259
E: MINOR=4
E: USEC_INITIALIZED=2631496
E: ID_SERIAL_SHORT= SYBBN00931050BB0T
E: ID_WWN=eui.ace42e002b1446de2ee4ac0000000001
E: ID_MODEL=PC801 NVMe SK hynix 1TB
E: ID_REVISION=51003141
E: ID_SERIAL=PC801_NVMe_SK_hynix_1TB____SYBBN00931050BB0T
E: ID_PATH=pci-0000:6f:00.5-pci-10001:84:00.0-nvme-1
E: ID_PATH_TAG=pci-0000_6f_00_5-pci-10001_84_00_0-nvme-1
E: ID_PART_TABLE_UUID=3670d982-3ad6-4568-bd13-280d90bdab83
E: ID_PART_TABLE_TYPE=gpt
E: DEVLINKS=/dev/disk/by-id/nvme-PC801_NVMe_SK_hynix_1TB____SYBBN00931050BB0T /dev/disk/by-path/pci-0000:6f:00.5-pci-10001:84:00.0-nvme-1 /dev/disk/by-id/nvme-eui.ace42e002b1446de2ee4ac0000000001
E: TAGS=:systemd:
E: CURRENT_TAGS=:systemd:

P: /devices/pci0000:6f/0000:6f:00.5/pci10001:80/10001:80:07.0/10001:84:00.0/nvme/nvme0/nvme0n1/nvme0n1p1
N: nvme0n1p1
L: 0
S: disk/by-uuid/11CB-B548
S: disk/by-partuuid/0d976fcb-c2d7-4949-8c47-2bcd1ea1d3d2
S: disk/by-path/pci-0000:6f:00.5-pci-10001:84:00.0-nvme-1-part1
S: disk/by-partlabel/EFI\x20System\x20Partition
S: disk/by-id/nvme-PC801_NVMe_SK_hynix_1TB____SYBBN00931050BB0T-part1
S: disk/by-id/nvme-eui.ace42e002b1446de2ee4ac0000000001-part1
E: DEVPATH=/devices/pci0000:6f/0000:6f:00.5/pci10001:80/10001:80:07.0/10001:84:00.0/nvme/nvme0/nvme0n1/nvme0n1p1
E: SUBSYSTEM=block
E: DEVNAME=/dev/nvme0n1p1
E: DEVTYPE=partition
E: DISKSEQ=13
E: PARTN=1
E: PARTNAME=EFI System Partition
E: MAJOR=259
E: MINOR=5
E: USEC_INITIALIZED=2699572
E: ID_SERIAL_SHORT= SYBBN00931050BB0T
E: ID_WWN=eui.ace42e002b1446de2ee4ac0000000001
E: ID_MODEL=PC801 NVMe SK hynix 1TB
E: ID_REVISION=51003141
E: ID_SERIAL=PC801_NVMe_SK_hynix_1TB____SYBBN00931050BB0T
E: ID_PATH=pci-0000:6f:00.5-pci-10001:84:00.0-nvme-1
E: ID_PATH_TAG=pci-0000_6f_00_5-pci-10001_84_00_0-nvme-1
E: ID_PART_TABLE_UUID=3670d982-3ad6-4568-bd13-280d90bdab83
E: ID_PART_TABLE_TYPE=gpt
E: ID_FS_UUID=11CB-B548
E: ID_FS_UUID_ENC=11CB-B548
E: ID_FS_VERSION=FAT16
E: ID_FS_TYPE=vfat
E: ID_FS_USAGE=filesystem
E: ID_PART_ENTRY_SCHEME=gpt
E: ID_PART_ENTRY_NAME=EFI\x20System\x20Partition
E: ID_PART_ENTRY_UUID=0d976fcb-c2d7-4949-8c47-2bcd1ea1d3d2
E: ID_PART_ENTRY_TYPE=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
E: ID_PART_ENTRY_NUMBER=1
E: ID_PART_ENTRY_OFFSET=34
E: ID_PART_ENTRY_SIZE=488248
E: ID_PART_ENTRY_DISK=259:4
E: UDISKS_IGNORE=1
E: DEVLINKS=/dev/disk/by-uuid/11CB-B548 /dev/disk/by-partuuid/0d976fcb-c2d7-4949-8c47-2bcd1ea1d3d2 /dev/disk/by-path/pci-0000:6f:00.5-pci-10001:84:00.0-nvme-1-part1 /dev/disk/by-partlabel/EFI\x20System\x20Partition /dev/disk/by-id/nvme-PC801_NVMe_SK_hynix_1TB____SYBBN00931050BB0T-part1 /dev/disk/by-id/nvme-eui.ace42e002b1446de2ee4ac0000000001-part1
E: TAGS=:systemd:
E: CURRENT_TAGS=:systemd:

P: /devices/pci0000:c9/0000:c9:00.5
L: 0
E: DEVPATH=/devices/pci0000:c9/0000:c9:00.5
E: SUBSYSTEM=pci
E: DRIVER=vmd
E: PCI_CLASS=10400
E: PCI_ID=8086:28C0
E: PCI_SUBSYS_ID=8086:7270
E: PCI_SLOT_NAME=0000:c9:00.5
E: MODALIAS=pci:v00008086d000028C0sv00008086sd00007270bc01sc04i00
E: USEC_INITIALIZED=5686050
E: ID_PCI_CLASS_FROM_DATABASE=Mass storage controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=RAID bus controller
E: ID_VENDOR_FROM_DATABASE=Intel Corporation
E: ID_MODEL_FROM_DATABASE=Volume Management Device NVMe RAID Controller

P: /devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:01.0
L: 0
E: DEVPATH=/devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:01.0
E: SUBSYSTEM=pci
E: DRIVER=pcieport
E: PCI_CLASS=60400
E: PCI_ID=8086:352A
E: PCI_SUBSYS_ID=8086:0000
E: PCI_SLOT_NAME=10002:00:01.0
E: MODALIAS=pci:v00008086d0000352Asv00008086sd00000000bc06sc04i00
E: USEC_INITIALIZED=5692006
E: ID_PCI_CLASS_FROM_DATABASE=Bridge
E: ID_PCI_SUBCLASS_FROM_DATABASE=PCI bridge
E: ID_PCI_INTERFACE_FROM_DATABASE=Normal decode
E: ID_VENDOR_FROM_DATABASE=Intel Corporation

P: /devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:01.0/10002:01:00.0
L: 0
E: DEVPATH=/devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:01.0/10002:01:00.0
E: SUBSYSTEM=pci
E: DRIVER=nvme
E: PCI_CLASS=10802
E: PCI_ID=1179:0116
E: PCI_SUBSYS_ID=1179:0001
E: PCI_SLOT_NAME=10002:01:00.0
E: MODALIAS=pci:v00001179d00000116sv00001179sd00000001bc01sc08i02
E: USEC_INITIALIZED=5705244
E: ID_PCI_CLASS_FROM_DATABASE=Mass storage controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Non-Volatile memory controller
E: ID_PCI_INTERFACE_FROM_DATABASE=NVM Express
E: ID_VENDOR_FROM_DATABASE=Toshiba Corporation

P: /devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:01.0/10002:01:00.0/nvme/nvme1
N: nvme1
L: 0
E: DEVPATH=/devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:01.0/10002:01:00.0/nvme/nvme1
E: SUBSYSTEM=nvme
E: DEVNAME=/dev/nvme1
E: NVME_TRTYPE=pcie
E: MAJOR=238
E: MINOR=1
E: USEC_INITIALIZED=5747494
E: ID_PCI_CLASS_FROM_DATABASE=Mass storage controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Non-Volatile memory controller
E: ID_PCI_INTERFACE_FROM_DATABASE=NVM Express
E: ID_VENDOR_FROM_DATABASE=Toshiba Corporation

P: /devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:01.0/10002:01:00.0/nvme/nvme1/nvme1n1
N: nvme1n1
L: 0
S: disk/by-path/pci-0000:c9:00.5-pci-10002:01:00.0-nvme-1
S: disk/by-id/nvme-KXG50ZNV256G_NVMe_TOSHIBA_256GB_18FF71JMFQ9S
S: disk/by-id/nvme-eui.000000000000001000080d0500053811
E: DEVPATH=/devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:01.0/10002:01:00.0/nvme/nvme1/nvme1n1
E: SUBSYSTEM=block
E: DEVNAME=/dev/nvme1n1
E: DEVTYPE=disk
E: DISKSEQ=9
E: MAJOR=259
E: MINOR=0
E: USEC_INITIALIZED=2675466
E: ID_SERIAL_SHORT=18FF71JMFQ9S
E: ID_WWN=eui.000000000000001000080d0500053811
E: ID_MODEL=KXG50ZNV256G NVMe TOSHIBA 256GB
E: ID_REVISION=AADA4102
E: ID_SERIAL=KXG50ZNV256G_NVMe_TOSHIBA_256GB_18FF71JMFQ9S
E: ID_PATH=pci-0000:c9:00.5-pci-10002:01:00.0-nvme-1
E: ID_PATH_TAG=pci-0000_c9_00_5-pci-10002_01_00_0-nvme-1
E: ID_FS_VERSION=1.2.01
E: ID_FS_TYPE=isw_raid_member
E: ID_FS_USAGE=raid
E: DEVLINKS=/dev/disk/by-path/pci-0000:c9:00.5-pci-10002:01:00.0-nvme-1 /dev/disk/by-id/nvme-KXG50ZNV256G_NVMe_TOSHIBA_256GB_18FF71JMFQ9S /dev/disk/by-id/nvme-eui.000000000000001000080d0500053811
E: TAGS=:systemd:
E: CURRENT_TAGS=:systemd:

P: /devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:03.0/10002:02:00.0
L: 0
E: DEVPATH=/devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:03.0/10002:02:00.0
E: SUBSYSTEM=pci
E: DRIVER=nvme
E: PCI_CLASS=10802
E: PCI_ID=1179:0116
E: PCI_SUBSYS_ID=1179:0001
E: PCI_SLOT_NAME=10002:02:00.0
E: MODALIAS=pci:v00001179d00000116sv00001179sd00000001bc01sc08i02
E: USEC_INITIALIZED=5703643
E: ID_PCI_CLASS_FROM_DATABASE=Mass storage controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Non-Volatile memory controller
E: ID_PCI_INTERFACE_FROM_DATABASE=NVM Express
E: ID_VENDOR_FROM_DATABASE=Toshiba Corporation

P: /devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:03.0/10002:02:00.0/nvme/nvme2
N: nvme2
L: 0
E: DEVPATH=/devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:03.0/10002:02:00.0/nvme/nvme2
E: SUBSYSTEM=nvme
E: DEVNAME=/dev/nvme2
E: NVME_TRTYPE=pcie
E: MAJOR=238
E: MINOR=2
E: USEC_INITIALIZED=5733516
E: ID_PCI_CLASS_FROM_DATABASE=Mass storage controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Non-Volatile memory controller
E: ID_PCI_INTERFACE_FROM_DATABASE=NVM Express
E: ID_VENDOR_FROM_DATABASE=Toshiba Corporation

P: /devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:03.0/10002:02:00.0/nvme/nvme2/nvme2n1
N: nvme2n1
L: 0
S: disk/by-id/nvme-eui.000000000000001000080d0500053832
S: disk/by-path/pci-0000:c9:00.5-pci-10002:02:00.0-nvme-1
S: disk/by-id/nvme-KXG50ZNV256G_NVMe_TOSHIBA_256GB_18FF71KJFQ9S
E: DEVPATH=/devices/pci0000:c9/0000:c9:00.5/pci10002:00/10002:00:03.0/10002:02:00.0/nvme/nvme2/nvme2n1
E: SUBSYSTEM=block
E: DEVNAME=/dev/nvme2n1
E: DEVTYPE=disk
E: DISKSEQ=10
E: MAJOR=259
E: MINOR=1
E: USEC_INITIALIZED=2727216
E: ID_SERIAL_SHORT=18FF71KJFQ9S
E: ID_WWN=eui.000000000000001000080d0500053832
E: ID_MODEL=KXG50ZNV256G NVMe TOSHIBA 256GB
E: ID_REVISION=AADA4102
E: ID_SERIAL=KXG50ZNV256G_NVMe_TOSHIBA_256GB_18FF71KJFQ9S
E: ID_PATH=pci-0000:c9:00.5-pci-10002:02:00.0-nvme-1
E: ID_PATH_TAG=pci-0000_c9_00_5-pci-10002_02_00_0-nvme-1
E: ID_FS_VERSION=1.2.01
E: ID_FS_TYPE=isw_raid_member
E: ID_FS_USAGE=raid
E: DEVLINKS=/dev/disk/by-id/nvme-eui.000000000000001000080d0500053832 /dev/disk/by-path/pci-0000:c9:00.5-pci-10002:02:00.0-nvme-1 /dev/disk/by-id/nvme-KXG50ZNV256G_NVMe_TOSHIBA_256GB_18FF71KJFQ9S
E: TAGS=:systemd:
E: CURRENT_TAGS=:systemd:

P: /devices/virtual/block/md126
N: md126
L: 100
S: disk/by-id/md-uuid-28901efc:88e7c780:5346ef73:afb394c8
S: md/Volume0
E: DEVPATH=/devices/virtual/block/md126
E: SUBSYSTEM=block
E: DEVNAME=/dev/md126
E: DEVTYPE=disk
E: DISKSEQ=16
E: MAJOR=9
E: MINOR=126
E: USEC_INITIALIZED=2657198
E: MD_LEVEL=raid0
E: MD_DEVICES=4
E: MD_CONTAINER=/dev/md/imsm0
E: MD_MEMBER=0
E: MD_UUID=28901efc:88e7c780:5346ef73:afb394c8
E: MD_DEVNAME=Volume0
E: ID_PART_TABLE_UUID=27314e33-9574-4b2f-8812-83ef77d3549a
E: ID_PART_TABLE_TYPE=gpt
E: UDISKS_MD_LEVEL=raid0
E: UDISKS_MD_DEVICES=4
E: UDISKS_MD_CONTAINER=/dev/md/imsm0
E: UDISKS_MD_MEMBER=0
E: UDISKS_MD_UUID=28901efc:88e7c780:5346ef73:afb394c8
E: UDISKS_MD_DEVNAME=Volume0
E: UDISKS_MD_DEVICE_dev_nvme2n1_ROLE=1
E: UDISKS_MD_DEVICE_dev_nvme2n1_DEV=/dev/nvme2n1
E: UDISKS_MD_DEVICE_dev_nvme1n1_ROLE=0
E: UDISKS_MD_DEVICE_dev_nvme1n1_DEV=/dev/nvme1n1
E: UDISKS_MD_DEVICE_dev_nvme4n1_ROLE=3
E: UDISKS_MD_DEVICE_dev_nvme4n1_DEV=/dev/nvme4n1
E: UDISKS_MD_DEVICE_dev_nvme3n1_ROLE=2
E: UDISKS_MD_DEVICE_dev_nvme3n1_DEV=/dev/nvme3n1
E: DEVLINKS=/dev/disk/by-id/md-uuid-28901efc:88e7c780:5346ef73:afb394c8 /dev/md/Volume0
E: TAGS=:systemd:
E: CURRENT_TAGS=:systemd:

P: /devices/virtual/block/md126/md126p1
N: md126p1
L: 100
S: disk/by-uuid/1887-B911
S: disk/by-partuuid/23a6efff-6ffc-4e2f-8bf7-631fe13bbea3
S: disk/by-id/md-uuid-28901efc:88e7c780:5346ef73:afb394c8-part1
S: md/Volume0p1
E: DEVPATH=/devices/virtual/block/md126/md126p1
E: SUBSYSTEM=block
E: DEVNAME=/dev/md126p1
E: DEVTYPE=partition
E: DISKSEQ=16
E: PARTN=1
E: PARTNAME=EFI System Partition
E: MAJOR=259
E: MINOR=8
E: USEC_INITIALIZED=2786211
E: MD_LEVEL=raid0
E: MD_DEVICES=4
E: MD_CONTAINER=/dev/md/imsm0
E: MD_MEMBER=0
E: MD_UUID=28901efc:88e7c780:5346ef73:afb394c8
E: MD_DEVNAME=Volume0
E: ID_FS_UUID=1887-B911
E: ID_FS_UUID_ENC=1887-B911
E: ID_FS_VERSION=FAT16
E: ID_FS_TYPE=vfat
E: ID_FS_USAGE=filesystem
E: ID_PART_ENTRY_SCHEME=gpt
E: ID_PART_ENTRY_NAME=EFI\x20System\x20Partition
E: ID_PART_ENTRY_UUID=23a6efff-6ffc-4e2f-8bf7-631fe13bbea3
E: ID_PART_ENTRY_TYPE=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
E: ID_PART_ENTRY_NUMBER=1
E: ID_PART_ENTRY_OFFSET=34
E: ID_PART_ENTRY_SIZE=488248
E: ID_PART_ENTRY_DISK=9:126
E: UDISKS_IGNORE=1
E: DEVLINKS=/dev/disk/by-uuid/1887-B911 /dev/disk/by-partuuid/23a6efff-6ffc-4e2f-8bf7-631fe13bbea3 /dev/disk/by-id/md-uuid-28901efc:88e7c780:5346ef73:afb394c8-part1 /dev/md/Volume0p1
E: TAGS=:systemd:
E: CURRENT_TAGS=:systemd:
5 changes: 4 additions & 1 deletion checkbox-support/checkbox_support/parsers/udevadm.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ def bus(self):
else:
return "usb"
else:
return self._stack[-2]._environment.get("SUBSYSTEM")
if len(self._stack)>=2:
return self._stack[-2]._environment.get("SUBSYSTEM")
else:
return self._stack[0]._environment.get("SUBSYSTEM")

bus = self._environment.get("SUBSYSTEM")
if bus == "pnp":
Expand Down

0 comments on commit de07b8b

Please sign in to comment.