Bug 963488

Summary: libvirt: Use qom-get command on newer versions of qemu to make virDomainMemoryStats() usable again
Product: [Community] Virtualization Tools Reporter: Tadej Janež <tadej.j>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: jtomko, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-16 17:58:10 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:    
Bug Blocks: 878425    

Description Tadej Janež 2013-05-15 21:55:26 UTC
As explained by Eric Blake in en email to the virt-tools mailing-list (https://www.redhat.com/archives/virt-tools-list/2013-May/msg00035.html, I just added some minor modifications to the text):
Versions of qemu since 0.15 or so intentionally crippled the 'info balloon' command to plug a security hole, where qemu waited for the guest to report the stats. Thus, qemu only reported information that could be obtained without guest interaction.

Just recently, qemu switched to an event-based solution, where it periodically asks the guest without blocking, the guest informs qemu when it wants, and where libvirt can query the most recent guest information (if any) without blocking, which works to remove the hole of a non-cooperative guest stopping progress.
Patch to qemu-devel is here: https://lists.gnu.org/archive/html/qemu-devel/2013-01/msg04832.html

Libvirt should use the new QMP querying commands for those properties (on systems with a new enough qemu), in order to get guest memory stat reporting back operational.

Comment 1 Ján Tomko 2015-03-16 17:58:10 UTC
This should be fixed upstream in 1.1.1:
commit ab600621170985b580af438efd1fd049de39b054
Author:     John Ferlan <jferlan>
AuthorDate: 2013-07-11 19:18:48 -0400
Commit:     John Ferlan <jferlan>
CommitDate: 2013-07-16 08:44:52 -0400

    Add capability to fetch balloon stats
    
    This patch will add the qemuMonitorJSONGetMemoryStats() to execute a
    "guest-stats" on the balloonpath using "get-qom" replacing the former
    mechanism which looked through the "query-ballon" returned data for
    the fields.  The "query-balloon" code only returns 'actual' memory.
    Rather than duplicating the existing code, have the JSON API use the
    GetBalloonInfo API.
    
    A check in the qemuMonitorGetMemoryStats() will be made to ensure the
    balloon driver path has been set.  Since the underlying JSON code can
    return data not associated with the balloon driver, we don't fail on
    a failure to get the balloonpath.  Of course since we've made the check,
    we can then set the ballooninit flag.  Getting the path here is primarily
    due to the process reconnect path which doesn't attempt to set the
    collection period.

git describe: v1.1.0-202-gab60062 contains: v1.1.1-rc1~123