Bug 1525182

Summary: Should rebuild QEMU capabilities on KVM hosts if kernel version changes
Product: Red Hat Enterprise Linux 7 Reporter: Paolo Bonzini <pbonzini>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
Status: CLOSED ERRATA QA Contact: Luyao Huang <lhuang>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.5CC: dyuan, lmen, lmiksik, mtessun, pbonzini, rbalakri, xuzhang, yalzhang, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-3.9.0-9.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 11:02:08 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:

Description Paolo Bonzini 2017-12-12 17:46:36 UTC
A new kernel version can make new CPUID bits show up in KVM's capabilities.  So "uname -r" should be stored in the QEMU capabilities cache and checked at libvirt startup.

Comment 2 Jiri Denemark 2018-01-22 10:47:47 UTC
Patch sent upstream for review: https://www.redhat.com/archives/libvir-list/2018-January/msg00657.html

Comment 3 Jiri Denemark 2018-01-22 13:13:46 UTC
The patch is now pushed upstream as

commit 52b7d910b6b0ceeff50866774adba6efab55b2c0
Refs: v4.0.0-6-g52b7d910b6
Author:     Jiri Denemark <jdenemar>
AuthorDate: Mon Jan 22 11:37:04 2018 +0100
Commit:     Jiri Denemark <jdenemar>
CommitDate: Mon Jan 22 14:11:58 2018 +0100

    qemu: Refresh caps cache after booting a different kernel

    Whenever a different kernel is booted, some capabilities related to KVM
    (such as CPUID bits) may change. We need to refresh the cache to see the
    changes.

    Signed-off-by: Jiri Denemark <jdenemar>
    Reviewed-by: Daniel P. Berrange <berrange>

Comment 6 Luyao Huang 2018-01-24 02:37:48 UTC
Verify this bug with libvirt-3.9.0-9.el7.x86_64:

1. check caps file timestamp:

# ll /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml 
-rw-------. 1 root root 51770 Jan 23 21:11 /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml


2. check the kernel version in caps file:

# cat /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml

...
  <kernelVersion>3.10.0-837.el7.x86_64 #1 SMP Tue Jan 23 13:31:59 UTC 2018</kernelVersion>
...

3. install a new kernel and reboot:

4. check the caps file timestamp:

# ll /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml
-rw-------. 1 root root 51770 Jan 23 21:28 /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml

5. check the kernel  version in caps file:

  <kernelVersion>3.10.0-831.el7.x86_64 #1 SMP Wed Jan 17 15:59:59 EST 2018</kernelVersion>

6. restart libvirtd and recheck the caps file timestamp:

# service libvirtd restart
Redirecting to /bin/systemctl restart libvirtd.service

# ll /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml 
-rw-------. 1 root root 51770 Jan 23 21:28 /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml

Comment 10 errata-xmlrpc 2018-04-10 11:02:08 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/RHEA-2018:0704