Bug 1843534

Summary: libvirt: Fix virConnectGetDomainCapabilities() call with empty cache [rhel-8.2.0.z]
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Oneata Mircea Teodor <toneata>
Component: libvirtAssignee: Andrea Bolognani <abologna>
Status: CLOSED ERRATA QA Contact: Luyao Huang <lhuang>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 8.2CC: abologna, crobinso, dyuan, fdeutsch, jdenemar, jsuchane, knoel, lhuang, lijin, lmen, mtessun, toneata, virt-maint, xuzhang, yalzhang
Target Milestone: rcKeywords: ZStream
Target Release: 8.2Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-6.0.0-17.3.el8 Doc Type: Bug Fix
Doc Text:
Cause: With version 6.0.0, libvirt started querying emulator capabilities lazily to improve startup time: this means that information about the default emulator for the host are only fetched if at least one of the defined VMs uses it. Consequence: If no VMs using it are defined, virConnectGetDomainCapabilities() fails because information about the default emulator for the host are not found in the cache. Fix: When virConnectGetDomainCapabilities() is called, information about the default emulator for the host are fetched unconditionally. Result: virConnectGetDomainCapabilities() succeeds and reports information about the default emulator for the host.
Story Points: ---
Clone Of: 1836351 Environment:
Last Closed: 2020-07-29 22:30:00 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:
Embargoed:
Bug Depends On: 1836351    
Bug Blocks: 1842869    

Comment 6 yalzhang@redhat.com 2020-06-08 09:42:59 UTC
reproduce this bug on libvirt-libs-6.0.0-17.2.module+el8.2.0+6629+3fc0f2c2.x86_64
1. make sure there is no guest and no cache file

# ll /var/cache/libvirt/qemu/
total 0

# virsh list --all
 Id   Name   State
--------------------

2. run domcapabilities command

# virsh domcapabilities
error: failed to get emulator capabilities
error: invalid argument: unable to find any emulator to serve 'x86_64' architecture

3. use virt-install to install an vm, then try above command:
# virsh domcapabilities 
<domainCapabilities>
  <path>/usr/libexec/qemu-kvm</path>
  <domain>kvm</domain>
...

4. update the libvirt to latest libvirt-libs-6.0.0-17.3.module+el8.2.0+6907+6abdb1b6.x86_64
# ll /var/cache/libvirt/qemu
total 0

# virsh list --all
 Id   Name   State
--------------------

# virsh domcapabilities 
<domainCapabilities>
  <path>/usr/libexec/qemu-kvm</path>
  <domain>kvm</domain>
  <machine>pc-i440fx-rhel7.6.0</machine>
  <arch>x86_64</arch>
...

the result is as expected, set the bug to be verified.

Comment 8 errata-xmlrpc 2020-07-29 22:30:00 UTC
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, 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-2020:3234