Enabled qemu memory balloon stats when boot instance

Registered by Rui Chen on 2014-05-05

We can get vm memory stats from libvirt API 'virDomainMemoryStats', it help telemetry module like as: Ceilometer to collect vm memory usage, but by default the memory statistical feature is disable in qemu, we need to modify libvirt.xml in order to enabled memory statistical, like this:

    <memballoon model='virtio'>
      <stats period='10'/>
    </memballoon>

Add memballoon device and set period > 0 in libvirt.xml when boot instance.
Depends on libvirt 1.1.1+ and qemu 1.5+.

DocImpact:

1. If you want to use this feature, you need to add the option 'mem_stats_period=10' into nova.conf.

2. mem_stats_period is number of seconds to memory usage statistics period.

3. If you set mem_stats_period<=0, the memory stats will be disabled, by default mem_stats_period=10.

Refer to http://libvirt.org/html/libvirt-libvirt.html#virDomainMemoryStats for libvirt api details.
Refer to http://libvirt.org/formatdomain.html#elementsMemBalloon for memballoon details in libvirt.xml

Details of enabled memory stats:
http://paste.openstack.org/show/78624/

Blueprint information

Status:
Complete
Approver:
John Garbutt
Priority:
Low
Drafter:
Rui Chen
Direction:
Approved
Assignee:
Rui Chen
Definition:
Approved
Series goal:
Accepted for juno
Implementation:
Implemented
Milestone target:
milestone icon 2014.2
Started by
Rui Chen on 2014-07-11
Completed by
Thierry Carrez on 2014-09-05

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/enabled-qemu-memballoon-stats,n,z

Addressed by: https://review.openstack.org/92469
    Enabled qemu memory balloon stats

Spec not approved yet, un-targeting blueprint from juno-1 --johnthetubaguy (28th May 2014)

You should not set a milestone target unless the blueprint has been properly prioritized by the project drivers.
(This is an automated message)

Addressed by: https://review.openstack.org/106704
    Enabled qemu memory balloon stats

Just waiting for the last patch to merge now --johnthetubaguy 22nd July 2014

Arg, this no longer merges cleanly, so this is likely to be delayed, pushing to juno-3 --johnthetubaguy 22 July 2014

All patches in the gate, leaving in juno. --johnthetubaguy 2nd September 2014

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.