Bug 1848875
Summary: | The cdrom device can not list by nodedev-list | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux Advanced Virtualization | Reporter: | Lili Zhu <lizhu> |
Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> |
Status: | CLOSED ERRATA | QA Contact: | yalzhang <yalzhang> |
Severity: | low | Docs Contact: | |
Priority: | low | ||
Version: | 8.3 | CC: | chhu, jdenemar, jsuchane, lcheng, lmen, mprivozn, msekleta, smitterl, virt-maint, xuzhang, yalzhang |
Target Milestone: | rc | Keywords: | Triaged, Upstream |
Target Release: | 8.3 | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | libvirt-7.5.0-1.el8 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2021-11-16 07:49:57 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | 7.5.0 |
Embargoed: |
Description
Lili Zhu
2020-06-19 06:39:50 UTC
This bug also appeared with: libvirt-6.0.0-24.module+el8.2.1+6997+c666f621.x86_64 What does the nodevdev-list --tree prints out? Thanks. # virsh nodedev-list --tree computer | +- net_lo_00_00_00_00_00_00 +- net_virbr0_nic_52_54_00_ed_91_76 +- pci_0000_00_00_0 +- pci_0000_00_01_0 | | | +- drm_card0 | +- pci_0000_00_02_0 | | | +- pci_0000_01_00_0 | | | +- net_enp1s0_52_54_00_8c_61_87 | +- pci_0000_00_02_1 | | | +- pci_0000_02_00_0 | | | +- usb_usb1 | | | | | +- usb_1_0_1_0 | | +- usb_1_1 | | | | | +- usb_1_1_1_0 | | | +- usb_usb2 | | | +- usb_2_0_1_0 | +- pci_0000_00_02_2 | | | +- pci_0000_03_00_0 | +- pci_0000_00_02_3 | | | +- pci_0000_04_00_0 | | | +- block_vda | +- pci_0000_00_02_4 | | | +- pci_0000_05_00_0 | +- pci_0000_00_02_5 | | | +- pci_0000_06_00_0 | +- pci_0000_00_02_6 +- pci_0000_00_1b_0 +- pci_0000_00_1f_0 +- pci_0000_00_1f_2 | | | +- scsi_host0 | | | | | +- scsi_target0_0_0 | | | | | +- scsi_0_0_0_0 | | | | | +- scsi_generic_sg0 | | | +- scsi_host1 | +- scsi_host2 | +- scsi_host3 | +- scsi_host4 | +- scsi_host5 | +- pci_0000_00_1f_3 This is because there's a difference in RHEL udev and other udevs. For instance, on RHEL I get the following: udevadm info /sys/class/block/sr0 | grep ID_TYPE E: ID_TYPE=cd/dvd but on Fedora I get different type: udevadm info /sys/class/block/sr0 | grep ID_TYPE E: ID_TYPE=cd I'll investigate further, why udev reports different type and what we can do about it. @msekleta Michal, do you perhaps have an idea whom should I ask about this? Libvirt is expecting "cd" but on RHEL we see "cd/dvd". Making libvirt accept both is trivial, it's just that I'd like to understand what has caused this. Alright, after some more debugging I've found the root cause. The problem is with sg3_utils package, more specifically with its udev rules. When udev processes a SCSI device and if sg3_utils package is installed then /lib/udev/rules.d/61-scsi-sg3_id.rules file is processed too. And here lies the difference. On recently enough Fedora (sg3_utils-1.46-1.fc35.x86_64) The file contains the following rules (among plenty others which I'm leaving out): IMPORT{program}="/usr/bin/sg_inq --export $env{.INQUIRY_DEV}", ENV{ID_SCSI}="1" ENV{ID_TYPE}!="?*", ENV{SCSI_TYPE}=="?*", ENV{ID_TYPE}="$env{SCSI_TYPE}" This sets ID_TYPE to whatever "sg_inq --export /dev/sr0" reports ("cd/dvd") but only if ID_TYPE was not set earlier (it was). Compare these rules to the following taken from RHEL (sg3_utils-1.44-5.el8.x86_64): KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}!="1", IMPORT{program}="/usr/bin/sg_inq --export $tempnode", ENV{ID_SCSI}="1" ENV{SCSI_TYPE}=="?*", ENV{ID_TYPE}="$env{SCSI_TYPE}" Here we can see the same binary being executed with the same set of arguments, but the other rule is different. It overwrites ID_TYPE basically always. And I can confirm that removing sg3_utils package makes virsh report CDROMs too. Of course, the proper fix is to make libvirt acceps "cd/dvd" type. Will send a patch soon. Patches posted here: https://listman.redhat.com/archives/libvir-list/2021-June/msg00041.html Merged upstream as: e76ec0fe65 (HEAD -> master, origin/master, origin/HEAD, udev_class_storage) node_device_udev: Also process ID_TYPE=cd/dvd in udevProcessStorage() 791b1173d0 node_device_udev: Don't overwrite @ret in udevProcessStorage() 950a9b256b node_device_udev: Make udevGetStringProperty() return void a5a47e9fa5 node_device_udev: Make udevGenerateDeviceName() return void v7.4.0-32-ge76ec0fe65 Reproduce this bug on libvirt-7.4.0-1.module+el8.5.0+11218+83343022.x86_64, and test on libvirt-7.5.0-1.module+el8.5.0+11664+59f87560.x86_64, the bug is fixed. on libvirt-7.5.0-1.module+el8.5.0+11664+59f87560.x86_64, nodedev-list can list the cdrom device. # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 30G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 29G 0 part ├─rhel-root 253:0 0 28G 0 lvm / └─rhel-swap 253:1 0 1G 0 lvm [SWAP] sr0 11:0 1 1024M 0 rom # virsh nodedev-list --cap storage block_sda_QEMU_HARDDISK_QM00001 block_sr0_0QEMU_QEMU_CD_ROM_drive_scsi0_0_0_3 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (virt:av bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2021:4684 |