Bug 822094 - RFE: Avoid calling 'query-balloon' monitor API in virDomainGetXMLDesc and virDomainGetInfo
RFE: Avoid calling 'query-balloon' monitor API in virDomainGetXMLDesc and vir...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Gunannan Ren
Virtualization Bugs
: FutureFeature
Depends On: 822092
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-16 06:22 EDT by Daniel Berrange
Modified: 2014-06-17 20:40 EDT (History)
6 users (show)

See Also:
Fixed In Version: libvirt-0.10.2-3.el7
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 05:25:09 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Daniel Berrange 2012-05-16 06:22:21 EDT
Description of problem:
In the QEMU impl of virDomainGetXMLDesc and virDomainGetInfo we currently invoke the 'query-balloon' QMP command to update our view of the balloon driver. This has caused no end of trouble for RHEV, virt-manager & GNOME Boxes because it makes these APIs significantly slower and means libvirt is susceptible to a "hung" QEMU process.

With QEMU able to provide an event notification we must disable these API calls from libvirt, once we see a BALLOON_CHANGE event emitted and rely on the async event notifications instead.
Comment 1 Daniel Berrange 2012-05-16 10:42:00 EDT
Proof of concept impl

https://www.redhat.com/archives/libvir-list/2012-May/msg00868.html
Comment 2 Gunannan Ren 2012-07-14 04:11:55 EDT
These two patches have been pushed upstream afte a little modification. set to POST.

commit 1d9d5103b4558e5bc2310b25b486847f50e66d3b
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Thu Jul 12 23:45:57 2012 +0800

    Wire up handling for QMP's BALLOON_EVENT
    
    If QEMU supports the BALLOON_EVENT QMP event, then we can
    avoid invoking 'query-balloon' when returning XML or the
    domain info.

commit 7ed6d7dda78b48ee02af285f6edfbe6dd719c2bc
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Fri Jul 13 17:05:17 2012 +0800

    Define public API for receiving guest memory balloon events
    
    When the guest changes its memory balloon applications may want
    to know what the new value is, without having to periodically
    poll on XML / domain info. Introduce a "balloon change" event
    to let apps see this
Comment 3 min zhan 2012-12-24 03:00:46 EST
Verified on the following pkgs:
libvirt-1.0.1-1.el7.x86_64
qemu-kvm-1.2.0-21.el7.x86_64

Steps:
1. Start the guest
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     rhel6u3                        shut off
# virsh dumpxml rhel6u3
<domain type='kvm'>
  <name>rhel6u3</name>
  <uuid>79aaa2c7-08c4-11d6-8610-b8dd52dcc26d</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
...
# virsh start rhel6u3
Domain rhel6u3 started

# python /usr/share/doc/libvirt-python-1.0.1/events-python/event-test.py 
Using uri:qemu:///system
myDomainEventCallback1 EVENT: Domain rhel6u3(71) Started Booted
myDomainEventCallback2 EVENT: Domain rhel6u3(71) Started Booted

2. change the memory
# virsh setmem rhel6u3 800M

# python /usr/share/doc/libvirt-python-1.0.1/events-python/event-test.py 
Using uri:qemu:///system
myDomainEventCallback1 EVENT: Domain rhel6u3(71) Started Booted
myDomainEventCallback2 EVENT: Domain rhel6u3(71) Started Booted
myDomainEventBalloonChangeCallback: Domain rhel6u3(71) 1047552
myDomainEventBalloonChangeCallback: Domain rhel6u3(71) 819200

3. # pidof qemu-kvm
9859
# kill -STOP 9859

4. # virsh dumpxml rhel6u3
<domain type='kvm' id='71'>
  <name>rhel6u3</name>
  <uuid>79aaa2c7-08c4-11d6-8610-b8dd52dcc26d</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>819200</currentMemory>
  <vcpu placement='static'>1</vcpu>
...

# virsh dominfo rhel6u3
Id:             71
Name:           rhel6u3
UUID:           79aaa2c7-08c4-11d6-8610-b8dd52dcc26d
OS Type:        hvm
State:          running
CPU(s):         1
CPU time:       23.3s
Max memory:     1048576 KiB
Used memory:    819200 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c97,c639 (enforcing)


virsh dumpxml or dominfo can return immediately even if the qemu process is stopped and not responding. 

------------
Reproduced with 
libvirt-0.9.11.3-1.el7.x86_64
qemu-kvm-1.0-17.1.el7.x86_64

Steps:

# virsh start rhel63
Domain rhel63 started

# python /usr/share/doc/libvirt-python-0.9.11.3/events-python/event-test.py 
Using uri:qemu:///system
myDomainEventCallback1 EVENT: Domain rhel63(2) Started Booted
myDomainEventCallback2 EVENT: Domain rhel63(2) Started Booted


# virsh setmem rhel63 800M

# python /usr/share/doc/libvirt-python-0.9.11.3/events-python/event-test.py 
Using uri:qemu:///system

no more other events.

# pidof qemu-kvm
6246
# kill -STOP 6246
# virsh dumpxml rhel63

it will block until execute 'kill -CONT 6246', then result will be returned.

# kill -STOP 6246
# virsh dominfo rhel63
Id:             3
Name:           rhel63
UUID:           26a08941-e4b2-6cad-33f9-ae55505892ac
OS Type:        hvm

It will block here until execute 'kill -CONT 6246', then the whole result will be returned.
Comment 4 Ludek Smid 2014-06-13 05:25:09 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

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