Bug 1870072
Summary: | Failed to detach virtio-scsi controller which is unused | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux Advanced Virtualization | Reporter: | gaojianan <jgao> |
Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
Status: | CLOSED ERRATA | QA Contact: | Han Han <hhan> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 8.0 | CC: | ddepaula, jdenemar, lmen, meili, pkrempa, virt-maint, xuzhang, yalzhang |
Target Milestone: | rc | Keywords: | Triaged |
Target Release: | 8.3 | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | libvirt-6.10.0-1.el8 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2021-05-25 06:43:34 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: | 6.10.0 |
Embargoed: |
Description
gaojianan
2020-08-19 10:09:33 UTC
Fixed upstream: commit 6a1bb797a7f90de131e2f5ccf4592c9324f875b0 Author: Peter Krempa <pkrempa> Date: Fri Nov 13 14:16:45 2020 +0100 qemuDomainControllerIsBusy: Fully populate switch statement Typecast the controller type variable to the appropriate type and add the missing controller types for future extension. Note that we currently allow only unplug of VIR_DOMAIN_CONTROLLER_TYPE_SCSI thus the other controller types which are not implemented return false now. Signed-off-by: Peter Krempa <pkrempa> Reviewed-by: Ján Tomko <jtomko> commit 279ba2d1cceceb70fa2463da7075bfe7cb6e43a3 Author: Peter Krempa <pkrempa> Date: Fri Nov 13 14:15:19 2020 +0100 qemuDomainDiskControllerIsBusy: Optimize checking for SCSI hostdevs Iterate through hostdevs only when the controller type is VIR_DOMAIN_CONTROLLER_TYPE_SCSI. Signed-off-by: Peter Krempa <pkrempa> Reviewed-by: Ján Tomko <jtomko> commit 022f4d431b7fffc5caa28b9872a061360410e0b2 Author: Peter Krempa <pkrempa> Date: Fri Nov 13 14:07:40 2020 +0100 qemuDomainDiskControllerIsBusy: Fix logic of matching disk bus to controller type The tests which match the disk bus to the controller type were backwards in this function. This meant that any disk bus type (such as VIR_DOMAIN_DISK_BUS_SATA) would not skip the controller index comparison even if the removed controller was of a different type. Switch the internals to a switch statement with selects the controller type in the first place and a proper type so that new controller types are added in the future. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1870072 Signed-off-by: Peter Krempa <pkrempa> Reviewed-by: Ján Tomko <jtomko> commit a6d5a5712f68ee2f528b7f8b99feeec2c243ddf0 Author: Peter Krempa <pkrempa> Date: Fri Nov 13 13:53:57 2020 +0100 qemuDomain(Disk)ControllerIsBusy: Fix function header format Signed-off-by: Peter Krempa <pkrempa> Reviewed-by: Ján Tomko <jtomko> Test on qemu-kvm-5.2.0-0.module+el8.4.0+8855+a9e237a9.x86_64 libvirt-6.10.0-1.module+el8.4.0+8898+a84e86e1.x86_64: 1. Prepare a running VM with following: sata disk with bus number 0 and scsi controller with index 0, no scsi device attached to scsi controller: <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/tmp/sata'/> <backingStore/> <target dev='sda' bus='sata'/> <alias name='sata0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <controller type='sata' index='0'> <alias name='ide'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/> </controller> <controller type='scsi' index='0' model='virtio-scsi'> <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/> </controller> 2. Try to detach the scsi controller: ➜ ~ cat /tmp/scsi-controller.xml <controller type='scsi' index='0' model='virtio-scsi'> <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/> </controller> ➜ ~ virsh detach-device vm1 /tmp/scsi-controller.xml Device detached successfully ➜ ~ virsh dumpxml vm1 |grep scsi 3. Then attach&detach the scsi controller: ➜ ~ virsh dumpxml vm1 |grep scsi ➜ ~ virsh attach-device vm1 /tmp/scsi-controller.xml Device attached successfully ➜ ~ virsh dumpxml vm1 |grep scsi <controller type='scsi' index='0' model='virtio-scsi'> <alias name='scsi0'/> ➜ ~ virsh detach-device vm1 /tmp/scsi-controller.xml Device detached successfully ➜ ~ virsh dumpxml vm1 |grep scsi It works as expected. Test as comment3 on libvirt-6.10.0-1.module+el8.4.0+8898+a84e86e1.x86_64 qemu-kvm-5.2.0-2.module+el8.4.0+9186+ec44380f.x86_64. Pass 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:2098 |