Description of problem: A pci host device was added to the VM. === engine=# select device,type from vm_device where vm_id='4a474e30-dcde-4541-8f2f-5607ae22f563' and type='hostdev'; device | type ------------------+--------- pci_0000_00_07_0 | hostdev (1 row) === Then the host was removed from the manager. However the device was not removed from the from the vm_device table although it's not showing up in the "Host Devices" tab of VM. The VM will will to start on any other host with below error. === 2020-10-09 15:21:04,082+0530 ERROR (vm/59df4177) [virt.vm] (vmId='59df4177-e10b-4cc1-a4b2-94ae86979d6f') Failed to setup device pci_0000_00_07_0 (vm:2629) === Even if the original host is added back, the Host devices tab of VM doesn't show this device. Also if a user try to add te same device again using "add device" option in GUI, it will not show this PCI device. The only option to reolve the issue is to remove the device manually from the database. Version-Release number of selected component (if applicable): rhvm-4.4.1.10-0.1.el8ev.noarch How reproducible: 100% Steps to Reproduce: 1. Attach a host device to the VM. 2. Remove the host. 3. Check the vm_device table. The hostdev device will be still in that table. 4. Check the "Host Devices" tab of that VM in manager GUI. That device will not be visbile. 5. Add the host back to the manager. 6. Try to add host device for the same VM. It will filter out the device which is in vm_device table. Actual results: VM host device is not removed while removing the host Expected results: I think there should be some validation while removing the host if there are VMs still using the host devices. Or it should automatically remove the device from the vm_device table. Additional info:
Verified on RHV 4.4.4-6. All looks good to me. Env: - Engine instance with RHV 4.4.4-6 (ovirt-engine-4.4.4.5-0.10.el8ev) and RHEL 8.3 installed. - 2 hosts with RHV 4.4.4-6 and RHEL 8.3, 3 hosts with vdsm-4.40.40-1.el8ev Steps: In Admin Portal: 1. Create a 4.5 data center and a 4.5 cluster. 2. Install the host and create a new NFS storage domain. 3. Create a VM with a disk with RHEL 8.3 installed and OS set to RHEL 8 and wait for its creation. 4. Add a PCI host device. 5. Check in the host devices tab and in the vm_device table that the host device is attached to the VM. 6. Remove the host which it's pci device was attached to the VM. 7. Check in the host devices tab and in the vm_device table that the host device is't attached anymore to the VM. 8. Install the same host we removed. 9. Add the same PCI device you added from the host to the same VM 10. Check in the host devices tab and in the vm_device table that the host device is attached to the VM. Results (As Expected): 1. The 4.5 data center and the 4.5 cluster were created. 2. The host was installed and the NFS storage domain was created. 3. The VM was created. 4. The PCI host device was added. 5. The host device is attached to the VM. 6. The host was removed. 7. The host device isn't attached to the VM. 8. The host was installed. 9. The PCI host device was added. 10. The host device is attached to the VM.
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 (RHV Engine and Host Common Packages 4.4.z [ovirt-4.4.4]), 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:0312