Adds memory utilization meter to libvirt inspector

Registered by Shunli Zhou on 2013-11-08

Per this link https://lists.launchpad.net/openstack/msg25265.html,
I would like to add the memory usage to the ceilometer.
As the libvirt has released many new version since Thu,18 Jul 2013.
I would like to use the following libvirt api to retrive the memory used by domain:

int virDomainMemoryStats (virDomainPtr dom,
      virDomainMemoryStatPtr stats,
      unsigned int nr_stats,
      unsigned int flags)

memory_used = VIR_DOMAIN_MEMORY_STAT_AVAILABLE - VIR_DOMAIN_MEMORY_STAT_UNUSED

Refer to http://libvirt.org/html/libvirt-libvirt.html#virDomainMemoryStats for libvirt api details.

Blueprint information

Status:
Complete
Approver:
Ildiko Vancsa
Priority:
Medium
Drafter:
Shunli Zhou
Direction:
Approved
Assignee:
Rui Chen
Definition:
Approved
Series goal:
Accepted for kilo
Implementation:
Implemented
Milestone target:
milestone icon 2015.1.0
Started by
Rui Chen on 2014-10-17
Completed by
Rui Chen on 2014-10-22

Related branches

Sprints

Whiteboard

Retrieve memory usage from libvirt 'virDomainMemoryStats' API directly.

memory_used = VIR_DOMAIN_MEMORY_STAT_AVAILABLE - VIR_DOMAIN_MEMORY_STAT_UNUSED

--- Rui Chen 28-04-2014

Add API virDomainMemoryStats since libvirt 0.7.5, but only 'actual' and 'rss' are returned by default, because memory balloon stats is disabled. Adding capability to fetch balloon stats in libvirt 1.1.1. Maybe I need to commit a nova blueprint to enable memory balloon stats when boot instance, then mark this blueprint depend on it.

Some informations:
http://libvirt.org/news.html
https://www.redhat.com/archives/libvir-list/2013-July/msg00108.html

--- Rui Chen 29-04-2014

Prepare this research of 'virDomainMemoryStats' on suitable libvirt1.1.1+ and qemu.

Used Memory stats is not supported by current Nova's target version libvirt(0.9.6+), and the Xen or LXC which don't support this API at all, so it's not a right time to implement it, suspend first.

--- Rui Chen 01-05-2014

The Nova gate was recently updated to Ubuntu 14.04 which has libvirt 1.2.2 and QEMU 2.0.0 so it should be testable now.

--- Rui Chen 03-07-2014

Gerrit topic: https://review.openstack.org/#q,topic:bp/libvirt-memory-utilization-inspector,n,z

Spec addressed by: https://review.openstack.org/129553
    Adds memory stats meter to libvirt inspector

Addressed by: https://review.openstack.org/90498
    Adds memory stats meter to libvirt inspector

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.