Bug 2160435
| Summary: | A hot-plugged scsi CDROM can't be ejected | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Xianghua Chen <xchen> | ||||
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> | ||||
| libvirt sub component: | Storage | QA Contact: | Han Han <hhan> | ||||
| Status: | CLOSED ERRATA | Docs Contact: | |||||
| Severity: | medium | ||||||
| Priority: | unspecified | CC: | dzheng, jdenemar, kkoukiou, lmen, mkletzan, pkrempa, qzhang, virt-maint, wshi, ymao, yunyang | ||||
| Version: | 9.2 | Keywords: | Triaged | ||||
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | libvirt-9.3.0-1.el9 | Doc Type: | If docs needed, set a value | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2023-11-07 08:30:47 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: | 9.3.0 | ||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
|
Description
Xianghua Chen
2023-01-12 12:19:15 UTC
Tried again since https://bugzilla.redhat.com/show_bug.cgi?id=1824722 is fixed now, problem is still there. Related to libvirt bug: https://bugzilla.redhat.com/show_bug.cgi?id=2166411 Since bug 2166411 is fixed, Tried again with : cockpit-machines-283-1.el9.noarch libvirt-9.0.0-6.el9.x86_64 qemu-kvm-7.2.0-8.el9.x86_64 Steps: 1. Create a running vm on RHEL9, enter vm details page 2. Prepare a iso like: # touch /var/lib/libvirt/images/fake1.iso 3. Click "Add disk", choose "Custom path" Custom path: /var/lib/libvirt/images/fake1.iso Device: CD/DVD disc Click "Add" 4. Click "Eject" after the new added disk , and click Eject on the dialog: Media could not be ejected from cirros internal error: unable to execute QEMU command 'blockdev-remove-medium': Tray of device 'scsi0-0-0-0' is not open 5. Click "Force eject" , no effect The problem is still there . This is reproduceable from CLI with: $ virsh change-media $VM_NAME sda --eject error: Failed to complete action eject on media error: internal error: unable to execute QEMU command 'blockdev-remove-medium': Tray of device 'scsi0-0-0-0' is not open Assuming that the media we are ejecting has target='sda' in the domain XML. Moving libvirt component for investigation as this is not specific to cockpit-machines. It looks like the Bug 2166411 - virt-xml: Updating cdrom device file: Error attempting device update: internal error: unable to execute QEMU command 'blockdev-remove-medium': Tray of device 'scsi0-0-0' is not open. Please help check the results on libvirt-9.0.0-4.el9 or the later versions. I cannot reproduce this with libvirt-9.0.0-10.el9_2.x86_64 so it might be a duplicate of Bug 2166411, testing cockpit-machines with the newer one would be beneficial. Also what is the guest OS in this case? Th It has been confirmed that the reproducing steps are: 1. Start a VM 2. Hot-plug the SCSI cdrom with media 3. Eject the cdrom by `virsh change-media --eject` If the VM starts with SCSI cdrom. Ejecting media by `virsh change-media --eject` will not meet the bug. BTW, such the SCSI cdrom hot-plug is supported since 3078799fef(v8.10.0). And the test cannot work on that version. Created attachment 1955433 [details]
scripts for reproducing
Ah, that makes sense. On hotplug of the cdrom we don't seem to refresh the state of the drive and thus we don't probe that it actually has a tray that needs to be ejected first. That's the reason it has exactly the same behaviour as what was fixed in bug 2166411 Fixed upstream:
commit fb1bfad7ad994756aa5bd821e03b89df7c1a5b23
Author: Peter Krempa <pkrempa>
Date: Wed Apr 19 16:49:52 2023 +0200
qemu: hotplug: Update disk private data after hotplug
The disk private data contain information about the tray and
removability of the disk. Until recently we didn't support hotplug of
removable disks thus it wasn't a problem but now when you can hotplug a
CDROM you would not be able to open its tray.
Fix it by updating the hotplugged disk the same way we do at startup.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2160435
Signed-off-by: Peter Krempa <pkrempa>
Reviewed-by: Ján Tomko <jtomko>
v9.2.0-284-gfb1bfad7ad
Works on libvirt-v9.2.0-296-g0eebdce995 qemu-kvm-7.2.0-14.el9_2.x86_64: + /root/libvirt/build/tools/virsh create /root/scsi-cdrom-hotplug-eject/rhel.xml Domain 'rhel' created from /root/scsi-cdrom-hotplug-eject/rhel.xml + /root/libvirt/build/tools/virsh event --domain rhel --event agent-lifecycle event 'agent-lifecycle' for domain 'rhel': state: 'connected' reason: 'channel event' events received: 1 + /root/libvirt/build/tools/virsh attach-device rhel /root/scsi-cdrom-hotplug-eject/cdrom.xml Device attached successfully + sleep 1 ++ xmllint --xpath 'string(/disk/target/@dev)' /root/scsi-cdrom-hotplug-eject/cdrom.xml + /root/libvirt/build/tools/virsh change-media rhel sdc --eject Successfully ejected media. + check_failure 'Fail to eject cdrom' 1 + '[' 0 -ne 0 ']' + clean + /root/libvirt/build/tools/virsh destroy rhel Domain 'rhel' destroyed Tested as comment12 on qemu-kvm-8.0.0-4.el9.x86_64 libvirt-9.3.0-2.el9.x86_64: + virsh create /root/scsi-cdrom-hotplug-eject/rhel.xml Domain 'rhel' created from /root/scsi-cdrom-hotplug-eject/rhel.xml + virsh event --domain rhel --event agent-lifecycle event 'agent-lifecycle' for domain 'rhel': state: 'connected' reason: 'channel event' events received: 1 + virsh attach-device rhel /root/scsi-cdrom-hotplug-eject/cdrom.xml Device attached successfully + sleep 1 ++ xmllint --xpath 'string(/disk/target/@dev)' /root/scsi-cdrom-hotplug-eject/cdrom.xml + virsh change-media rhel sdc --eject Successfully ejected media. + check_failure 'Fail to eject cdrom' 1 + '[' 0 -ne 0 ']' + clean + virsh destroy rhel Domain 'rhel' destroyed 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 (Moderate: libvirt security, 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/RHSA-2023:6409 |