Bug 863115 - libvirt calls 'qemu-kvm -help' too often
Summary: libvirt calls 'qemu-kvm -help' too often
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Eric Blake
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-04 13:12 UTC by Eric Blake
Modified: 2013-02-21 07:25 UTC (History)
10 users (show)

Fixed In Version: libvirt-0.10.2-3.el6
Doc Type: Bug Fix
Doc Text:
Cause: Libvirt was calling 'qemu-kvm -help' every time it started a guest, to learn what features qemu has available for use. Consequence: On a machine with lots of guests, this led to noticeable delays in starting all of the guests. Fix: Libvirt now caches information about qemu as long as qemu's timestamp is unchanged. Result: Reusing information allows libvirt to be faster when starting lots of guests.
Clone Of:
Environment:
Last Closed: 2013-02-21 07:25:42 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:0276 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2013-02-20 21:18:26 UTC

Description Eric Blake 2012-10-04 13:12:29 UTC
Description of problem:
Libvirt is spawning several qemu-kvm processes per guest, repeatedly gathering information such as 'qemu -help' output.  Caching this information will make libvirtd restarts faster.  Additionally, since this was one of the first patch series applied after upstream 0.10.2, and has a rather large refactoring effect on how qemu capabilities are managed, backporting the series now will make future backporting efforts easier to manage, as the upstream code base using capabilities will be similar to the RHEL 6.4 code base where fixes are being backported to.


Version-Release number of selected component (if applicable):
libvirt-0.10.2-1.el6

How reproducible:
100%

Steps to Reproduce:
1. start libvirtd with logging set to inspect all virCommand calls
2. start several guests running
3. notice how many times 'qemu-kvm -help' is executed
  
Actual results:
libvirt execs qemu-kvm several times per guest

Expected results:
qemu-kvm -help should be executed just once, at least until the qemu-kvm binary is updated

Additional info:
Backporting should pick up lots of danpb's patch series; for example, look at 'git log --oneline 1b21351b' for an idea of the patches in the series, which mixed two concepts of qemu-kvm capability caching and QMP capability determination.  We can't switch entirely to QMP parsing unless qemu also backports several new monitor commands, but Dan's code has been tested upstream to work even with older qemu.  So although it is not immediately obvious how easy it would be to disentangle the qemu capability caching from the interleaved commits related to dealing with the new monitor commands when present, it may make sense to backport even those patches that parse new monitor commands, even if that code isn't used on RHEL, just to minimize backport churn.

Comment 4 hongming 2012-10-16 09:06:41 UTC
Verify it as follows.The result is expected. So move its status to VERIFIED.

1.# rpm -q libvirt qemu-kvm
libvirt-0.10.2-3.el6.x86_64
qemu-kvm-0.12.1.2-2.322.el6.x86_64

2.Start two guests.
# virsh list 
 Id    Name                           State
----------------------------------------------------
 1     rhel6.3                        running
 2     rhel6.3-new                    running


3.Check debug log , the qemu-kvm -help only be executed once.
vim /var/log/libvirt/qemu/rhel6.3.log

2012-10-16 08:56:02.469+0000: 20566: debug : virCommandRunAsync:2209 : About to run LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin /usr/libexec/qemu-kvm -help

Comment 5 hongming 2012-11-08 05:46:53 UTC
(In reply to comment #4)
> Verify it as follows.The result is expected. So move its status to VERIFIED.
> 
> 1.# rpm -q libvirt qemu-kvm
> libvirt-0.10.2-3.el6.x86_64
> qemu-kvm-0.12.1.2-2.322.el6.x86_64
> 
> 2.Start two guests.
> # virsh list 
>  Id    Name                           State
> ----------------------------------------------------
>  1     rhel6.3                        running
>  2     rhel6.3-new                    running
> 
> 
> 3.Check debug log , the qemu-kvm -help only be executed once.
vim /var/log/libvirt/libvirtd.log
 
2012-10-16 08:56:02.469+0000: 20566: debug : virCommandRunAsync:2209 : About
to run LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin /usr/libexec/qemu-kvm -help

Fix a typo as above .

Comment 6 errata-xmlrpc 2013-02-21 07:25:42 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.

http://rhn.redhat.com/errata/RHSA-2013-0276.html


Note You need to log in before you can comment on or make changes to this bug.