Description of problem: Define a q35 guest with smm tseg, remove qemu-kvm-rhev and restart libvirtd, the vm disappears in virsh list. Should not perform this validation when reading configs from disk. This causes user confusion :"say qemu is accidentally uninstalled, and libvirtd is restarted. the qemu driver capabilities are now empty, and any pre-existing configs will fail to load. virsh list --all is now empty, and users are confused." per bz1043572. Version-Release number of selected component (if applicable): libvirt-4.5.0-28.el7.x86_64 qemu-kvm-rhev-2.12.0-38.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. start a q35 guest with smm tseg: <type arch='x86_64' machine='pc-q35-rhel7.6.0'>hvm</type> ... <smm state='on'> <tseg unit='MiB'>48</tseg> </smm> # virsh list --all Id Name State ---------------------------------------------------- - rhel7.7-q35 shut off 2. # rpm -e --nodeps qemu-kvm-rhev # virsh list --all Id Name State ---------------------------------------------------- - rhel7.7-q35 shut off 3. # systemctl restart libvirtd # systemctl restart libvirtd # virsh list --all Id Name State ---------------------------------------------------- # cat libvirtd.log |grep error 2019-11-07 07:17:51.450+0000: 97241: debug : virEventPollRunOnce:643 : Poll got error event 4 2019-11-07 07:17:52.428+0000: 97351: error : virQEMUCapsNewForBinaryInternal:4555 : Cannot check QEMU binary /usr/libexec/qemu-kvm: No such file or directory 2019-11-07 07:17:52.428+0000: 97351: error : qemuDomainDefTsegPostParse:3670 : unsupported configuration: Setting TSEG size is not supported with this QEMU binary 2019-11-07 07:17:52.429+0000: 97351: error : virDomainObjListLoadAllConfigs:630 : Failed to load config for domain 'rhel7.7-q35' Actual results: Q35 guest with smm tseg disappears in virsh list if remove qemu-kvm-rhev and restart libvirtd Expected results: Should not perform this validation when reading configs from disk. Additional info: 1. If remove tseg, will not reproduce. 2. Reinstall qemu-kvm-rhev, restart libvirtd, the vm shows in list again. 3. The vm with smm tseg can be started successfully when qemu-kvm-rhev installed there.
Created attachment 1633951 [details] libvirtd.log
Reproduces on rhel-av8.1.1 Pkgs info: libvirt-daemon-5.6.0-8.module+el8.1.1+4828+0f2d78eb.x86_64 qemu-kvm-4.1.0-15.module+el8.1.1+4700+209eec8f.x86_64 # virsh list --all|grep rhel8.1-ovmf - rhel8.1-ovmf shut off # rpm -e --nodeps qemu-kvm-core # systemctl restart libvirtd # virsh list --all|grep rhel8.1-ovmf # cat /var/log/libvirt/libvirtd.log |grep "error :" 2019-11-22 04:19:29.583+0000: 12438: error : virQEMUCapsNewForBinaryInternal:4668 : Cannot check QEMU binary /usr/libexec/qemu-kvm: No such file or directory 2019-11-22 04:19:29.583+0000: 12438: error : virQEMUCapsNewForBinaryInternal:4668 : Cannot check QEMU binary /usr/libexec/qemu-kvm: No such file or directory 2019-11-22 04:19:29.583+0000: 12438: error : virCapabilitiesDomainDataLookupInternal:754 : invalid argument: could not find capabilities for arch=x86_64 domaintype=kvm 2019-11-22 04:19:29.584+0000: 12438: error : virQEMUCapsNewForBinaryInternal:4668 : Cannot check QEMU binary /usr/libexec/qemu-kvm: No such file or directory 2019-11-22 04:19:29.584+0000: 12438: error : virCapabilitiesDomainDataLookupInternal:754 : invalid argument: could not find capabilities for arch=x86_64 domaintype=kvm 2019-11-22 04:19:29.585+0000: 12438: error : virQEMUCapsNewForBinaryInternal:4668 : Cannot check QEMU binary /usr/libexec/qemu-kvm: No such file or directory 2019-11-22 04:19:29.585+0000: 12438: error : qemuDomainDefTsegPostParse:4271 : unsupported configuration: Setting TSEG size is not supported with this QEMU binary 2019-11-22 04:19:29.585+0000: 12438: error : virDomainObjListLoadAllConfigs:638 : Failed to load config for domain 'rhel8.1-ovmf' 2019-11-22 04:19:29.586+0000: 12438: error : virCapabilitiesDomainDataLookupInternal:754 : invalid argument: could not find capabilities for arch=x86_64 domaintype=kvm 2019-11-22 04:19:29.587+0000: 12438: error : virQEMUCapsNewForBinaryInternal:4668 : Cannot check QEMU binary /usr/libexec/qemu-kvm: No such file or directory 2019-11-22 04:19:29.587+0000: 12438: error : qemuDomainDefTsegPostParse:4271 : unsupported configuration: Setting TSEG size is not supported with this QEMU binary 2019-11-22 04:19:29.588+0000: 12438: error : virDomainObjListLoadAllConfigs:638 : Failed to load config for domain 'full-rhel8.0' 2019-11-22 04:19:29.588+0000: 12438: error : virCapabilitiesDomainDataLookupInternal:754 : invalid argument: could not find capabilities for arch=x86_64 domaintype=kvm 2019-11-22 04:19:29.588+0000: 12438: error : virQEMUCapsNewForBinaryInternal:4668 : Cannot check QEMU binary /usr/libexec/qemu-kvm: No such file or directory 2019-11-22 04:19:29.589+0000: 12438: error : virCapabilitiesDomainDataLookupInternal:754 : invalid argument: could not find capabilities for arch=x86_64 domaintype=kvm 2019-11-22 04:19:29.589+0000: 12438: error : virQEMUCapsNewForBinaryInternal:4668 : Cannot check QEMU binary /usr/libexec/qemu-kvm: No such file or directory 2019-11-22 04:19:29.590+0000: 12438: error : virCapabilitiesDomainDataLookupInternal:754 : invalid argument: could not find capabilities for arch=x86_64 domaintype=kvm 2019-11-22 04:19:29.590+0000: 12438: error : virQEMUCapsNewForBinaryInternal:4668 : Cannot check QEMU binary /usr/libexec/qemu-kvm: No such file or directory ...
qemuDomainDefTsegPostParse does not skip the validation if qemuCaps is NULL. This is necessary for exactly this reason.
As of upstream commit: commit 8d157c13ccd5201385e8038669e24c3c47d4f302 Author: Daniel P. Berrangé <berrange> Date: Tue Dec 10 11:35:43 2019 +0000 qemu: honour parseOpaque instead of refetching caps The use of the parseOpaque parameter was mistakenly removed in commit 4a4132b4625778cf80acb9c92d06351b44468ac3 Author: Daniel P. Berrangé <berrange> Date: Tue Dec 3 10:49:49 2019 +0000 conf: don't use passed in caps in post parse method causing the method to re-fetch qemuCaps that were already just fetched and put into parseOpaque. This is inefficient when parsing incoming XML, but for live XML this is more serious as it means we use the capabilities for the current QEMU binary on disk, rather than the running QEMU. That commit, however, did have a useful side effect of fixing a crasher bug in the qemu post parse callback introduced by commit 5e939cea896fb3373a6f68f86e325c657429ed3d Author: Jiri Denemark <jdenemar> Date: Thu Sep 26 18:42:02 2019 +0200 qemu: Store default CPU in domain XML The qemuDomainDefSetDefaultCPU() method in that patch did not allow for the possibility that qemuCaps would be NULL and thus resulted in a SEGV. This shows a risk in letting each check in the post parse callback look for qemuCaps == NULL. The safer option is to check once upfront and immediately stop (postpone) further validation. The post-parse callbacks are postponed if qemuCaps are not present, so the VM will not vanish. v5.10.0-224-g8d157c13cc
Verified Version: libvirt-7.3.0-1.module+el8.5.0+11004+f4810536.x86_64 qemu-kvm-6.0.0-16.module+el8.5.0+10848+2dccc46d.x86_64 Verified Steps: 1. Prepare a guest with smm. # virsh list --all Id Name State --------------------------------- - lmn shut off # virsh dumpxml lmn | grep /smm -B2 <smm state='on'> <tseg unit='MiB'>48</tseg> </smm> 2. Uninstall qemu-kvm package. # rpm -e --nodeps qemu-kvm # virsh list --all Id Name State --------------------------------- - lmn shut off 3. Restart libvirtd and check virsh list. # systemctl restart libvirtd # virsh list --all Id Name State --------------------------------- - lmn shut off
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