Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getting names for MD member disks with MD properties (#1727180) #796

Conversation

vojtechtrefny
Copy link
Member

Some MD member disks have the 'MD_*' properties in UDev database
which confuses our 'udev.device_get_name' function.


The result is three devices with same name (two disks and the array). This doesn't happen for all arrays, I was able to reproduce this with a raid1 created directly on top of the disks (without partitions).

$ udevadm info /dev/vdc
P: /devices/pci0000:00/0000:00:0c.0/virtio6/block/vdc
N: vdc
L: 0
S: disk/by-path/pci-0000:00:0c.0
S: disk/by-path/virtio-pci-0000:00:0c.0
E: DEVPATH=/devices/pci0000:00/0000:00:0c.0/virtio6/block/vdc
E: DEVNAME=/dev/vdc
E: DEVTYPE=disk
E: MAJOR=252
E: MINOR=32
E: SUBSYSTEM=block
E: USEC_INITIALIZED=9888220
E: ID_PATH=pci-0000:00:0c.0
E: ID_PATH_TAG=pci-0000_00_0c_0
E: ID_FS_UUID=8a9a5a4a-bfa8-b1c7-2366-bcbde5ef324e
E: ID_FS_UUID_ENC=8a9a5a4a-bfa8-b1c7-2366-bcbde5ef324e
E: ID_FS_UUID_SUB=cae91f65-006e-ef11-b512-95331d445ea6
E: ID_FS_UUID_SUB_ENC=cae91f65-006e-ef11-b512-95331d445ea6
E: ID_FS_LABEL=localhost.localdomain:127
E: ID_FS_LABEL_ENC=localhost.localdomain:127
E: ID_FS_VERSION=1.2
E: ID_FS_TYPE=linux_raid_member
E: ID_FS_USAGE=raid
E: MD_DEVICE=md127
E: MD_DEVNAME=127
E: MD_FOREIGN=no
E: MD_STARTED=unsafe
E: SYSTEMD_WANTS=mdadm-last-resort@md127.timer
E: UDISKS_MD_MEMBER_LEVEL=raid1
E: UDISKS_MD_MEMBER_DEVICES=2
E: UDISKS_MD_MEMBER_NAME=localhost.localdomain:127
E: UDISKS_MD_MEMBER_ARRAY_SIZE=1071.64MB
E: UDISKS_MD_MEMBER_UUID=8a9a5a4a:bfa8b1c7:2366bcbd:e5ef324e
E: UDISKS_MD_MEMBER_UPDATE_TIME=1564873206
E: UDISKS_MD_MEMBER_DEV_UUID=cae91f65:006eef11:b5129533:1d445ea6
E: UDISKS_MD_MEMBER_EVENTS=20
E: DEVLINKS=/dev/disk/by-path/pci-0000:00:0c.0 /dev/disk/by-path/virtio-pci-0000:00:0c.0
E: TAGS=:systemd:

Some MD member disks have the 'MD_*' properties in UDev database
which confuses our 'udev.device_get_name' function.
@vojtechtrefny
Copy link
Member Author

The rawhie test fail is unrelated, it's just new version of pylint discovering new issues, I'll address this in a separate PR.

Copy link
Contributor

@vpodzime vpodzime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

# this device is actually not an MD device but a disk from the array
# these sometimes have the MD_* properties in udev database
name = udev_info["SYS_NAME"]
elif device_is_partition(udev_info):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See b4e9cee for an alternative solution to this which covers partitions as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. This fixes the crash, the array is added correctly to the tree, but not the partitions on it. In my case the name of the array is actually 127, so we need to try to add partitions with name 127p1 because md127p1` doesn't work with parted:

DEBUG:blivet: looking up parted Partition: /dev/md/md127p1
ERROR:blivet: Failed to instantiate PartitionDevice: ('cannot find parted partition instance', 'md127p1')
DEBUG:blivet: no device obtained for md127p1

But from the bug mentioned in your patch it looks like the problem there was completely opposite -- we were trying to add partition /dev/10p3 instead of /dev/md/10p3 or /dev/md10p3.

@vojtechtrefny
Copy link
Member Author

Closing, see #827

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants