Bug 2013523
| Summary: | Save and restore the vm with cdrom cause the vm's cdrom tray locked | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | yalzhang <yalzhang> |
| Component: | libvirt | Assignee: | khanicov |
| libvirt sub component: | General | QA Contact: | Han Han <hhan> |
| Status: | CLOSED ERRATA | Docs Contact: | |
| Severity: | medium | ||
| Priority: | high | CC: | fjin, hhan, jdenemar, jsuchane, khanicov, kwolf, lmen, mprivozn, pkrempa, rjoyce, smitterl, virt-maint, xuzhang |
| Version: | 9.1 | Keywords: | Regression, Triaged |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-8.9.0-1.el9 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-05-09 07:26:10 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: | 8.9.0 |
| Embargoed: | |||
Also described here: https://bugzilla.redhat.com/show_bug.cgi?id=1824722#c1 Upstream issue: https://gitlab.com/libvirt/libvirt/-/issues/301 Merged upstream as: 7356dce2b3 qemu: Refresh state after restore from a save image v8.8.0-160-g7356dce2b3 This bug was solved by mprivozn. Tested on libvirtv8.8.0-172-gf1d63048b7 qemu-7.1.0-3.fc38.x86_64:
1. Start an VM with cdrom
2. Check the cdrom status by QMP `info block`
➜ ~ virsh qemu-monitor-command rhel9 --hmp info block
libvirt-2-format: /var/lib/libvirt/images/1 (raw)
Attached to: /machine/peripheral/virtio-disk0/virtio-backend
Cache mode: writeback
libvirt-1-format: /var/lib/libvirt/images/boot.iso (raw, read-only)
Attached to: scsi0-0-0-1
Removable device: locked, tray closed
Cache mode: writeback
Save and restore the CDROM
➜ ~ virsh save rhel9 /tmp/rhel9.save
Domain 'rhel9' saved to /tmp/rhel9.save
➜ ~ virsh restore /tmp/rhel9.save
Domain restored from /tmp/rhel9.save
Check the Removable device status of the cdrom. Expect the same with what is before the save&restore
➜ ~ virsh qemu-monitor-command rhel9 --hmp info block
libvirt-2-format: /var/lib/libvirt/images/1 (raw)
Attached to: /machine/peripheral/virtio-disk0/virtio-backend
Cache mode: writeback
libvirt-1-format: /var/lib/libvirt/images/boot.iso (raw, read-only)
Attached to: scsi0-0-0-1
Removable device: locked, tray closed
Cache mode: writeback
3. Execute `eject -i off /dev/sr0` to change the locked status. And redo step2
libvirt-2-format: /var/lib/libvirt/images/1 (raw)
Attached to: /machine/peripheral/virtio-disk0/virtio-backend
Cache mode: writeback
libvirt-1-format: /var/lib/libvirt/images/boot.iso (raw, read-only)
Attached to: scsi0-0-0-1
Removable device: not locked, tray closed
Cache mode: writeback
Save and restore the CDROM
➜ ~ virsh save rhel9 /tmp/rhel9.save
Domain 'rhel9' saved to /tmp/rhel9.save
➜ ~ virsh restore /tmp/rhel9.save
Domain restored from /tmp/rhel9.save
Check the Removable device status of the cdrom. Expect the same with what is before the save&restore
➜ ~ virsh qemu-monitor-command rhel9 --hmp info block
libvirt-2-format: /var/lib/libvirt/images/1 (raw)
Attached to: /machine/peripheral/virtio-disk0/virtio-backend
Cache mode: writeback
libvirt-1-format: /var/lib/libvirt/images/boot.iso (raw, read-only)
Attached to: scsi0-0-0-1
Removable device: not locked, tray closed
Cache mode: writeback
Test as comment0 on libvirt-8.9.0-2.el9.x86_64 qemu-kvm-7.1.0-4.el9.x86_64. PASS ➜ ~ virsh qemu-monitor-command rhel-9.2 --hmp info block libvirt-3-format: /var/lib/libvirt/images/rhel-9.2.qcow2 (qcow2) Attached to: /machine/peripheral/virtio-disk0/virtio-backend Cache mode: writeback libvirt-2-format: /tmp/usb (raw) Attached to: /machine/peripheral/usb-disk1/usb-disk1.0/legacy[0] Removable device: not locked, tray closed Cache mode: writeback libvirt-1-format: /var/lib/libvirt/images/boot.iso (raw, read-only) Attached to: scsi0-0-0-2 Removable device: not locked, tray closed Cache mode: writeback ➜ ~ virsh save rhel-9.2 /tmp/rhel Domain 'rhel-9.2' saved to /tmp/rhel ➜ ~ rpm -q libvirt libvirt-8.9.0-2.el9.x86_64 ➜ ~ virsh restore /tmp/rhel Domain restored from /tmp/rhel ➜ ~ virsh qemu-monitor-command rhel-9.2 --hmp info block libvirt-3-format: /var/lib/libvirt/images/rhel-9.2.qcow2 (qcow2) Attached to: /machine/peripheral/virtio-disk0/virtio-backend Cache mode: writeback libvirt-2-format: /tmp/usb (raw) Attached to: /machine/peripheral/usb-disk1/usb-disk1.0/legacy[0] Removable device: not locked, tray closed Cache mode: writeback libvirt-1-format: /var/lib/libvirt/images/boot.iso (raw, read-only) Attached to: scsi0-0-0-2 Removable device: not locked, tray closed Cache mode: writeback ➜ ~ cat empty.xml <disk type="file" device="cdrom"> <driver name="qemu" type="raw"/> <backingStore/> <target dev="sdc" bus="scsi"/> <readonly/> <alias name="scsi0-0-0-2"/> <address type="drive" controller="0" bus="0" target="0" unit="2"/> </disk> ➜ ~ virsh update-device rhel-9.2 empty.xml Device updated successfully 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 (libvirt 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-2023:2171 |
Description of problem: Save and restore the vm with cdrom cause the vm's cdrom tray locked Version-Release number of selected component (if applicable): libvirt-7.6.0-4.module+el8.5.0+12786+c4633d9a.x86_64 qemu-kvm-6.0.0-31.module+el8.5.0+12787+aaa8bdfa.x86_64 How reproducible: 100% Steps to Reproduce: 1. Start a vm with a cdrom device: # virsh start test Domain 'test' started # virsh dumpxml test | grep /disk -B12 <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/RHEL-8.5-x86_64-latest.qcow2' index='2'/> <backingStore/> <target dev='sda' bus='sata'/> <alias name='sata0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/new.iso' index='1'/> <backingStore/> <target dev='sdb' bus='scsi'/> <readonly/> <alias name='scsi0-0-0-1'/> <address type='drive' controller='0' bus='0' target='0' unit='1'/> </disk> # virsh qemu-monitor-command test --hmp info block libvirt-2-format: /var/lib/libvirt/images/RHEL-8.5-x86_64-latest.qcow2 (qcow2) Attached to: sata0-0-0 Cache mode: writeback libvirt-1-format: /var/lib/libvirt/images/new.iso (raw, read-only) Attached to: scsi0-0-0-1 Removable device: **not locked**, tray closed Cache mode: writeback 2. Save and restore the vm # virsh save test test_save Domain 'test' saved to test_save # virsh restore test_save Domain restored from test_save 3. Check the cdrom device, it is locked: # virsh qemu-monitor-command test --hmp info block libvirt-2-format: /var/lib/libvirt/images/RHEL-8.5-x86_64-latest.qcow2 (qcow2) Attached to: sata0-0-0 Cache mode: writeback libvirt-1-format: /var/lib/libvirt/images/new.iso (raw, read-only) Attached to: scsi0-0-0-1 Removable device: **locked**, tray closed Cache mode: writeback 4. Try to eject the cdrom by update-device, it failed: # cat disknew.xml <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <backingStore/> <target dev='sdb' bus='scsi'/> <readonly/> <alias name='scsi0-0-0-1'/> <address type='drive' controller='0' bus='0' target='0' unit='1'/> </disk> # virsh update-device test disknew.xml error: Failed to update device from disknew.xml error: internal error: unable to execute QEMU command 'blockdev-remove-medium': Tray of device 'scsi0-0-0-1' is not open # cat /var/log/libvirt/libvirtd.log | grep -i error 2021-10-13 05:24:31.386+0000: 223914: info : qemuMonitorJSONIOProcessLine:240 : QEMU_MONITOR_RECV_REPLY: mon=0x7f676004b190 reply={"id": "libvirt-385", "error": {"class": "GenericError", "desc": "Tray of device 'scsi0-0-0-1' is not open"}} 2021-10-13 05:24:31.386+0000: 223295: error : qemuMonitorJSONCheckErrorFull:415 : internal error: unable to execute QEMU command 'blockdev-remove-medium': Tray of device 'scsi0-0-0-1' is not open Actual results: Save and restore the vm with cdrom cause the vm's cdrom tray locked Expected results: The tray should not be locked after save and restore, and the update should succeed Additional info: