Bug 1264684 - RFE: use libvirt virConnectGetAllDomainStats
RFE: use libvirt virConnectGetAllDomainStats
Status: NEW
Product: Virtualization Tools
Classification: Community
Component: virt-manager (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Cole Robinson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-20 13:28 EDT by Cole Robinson
Modified: 2015-09-20 13:29 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
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 Cole Robinson 2015-09-20 13:28:31 EDT
Since libvirt 1.2.8 there's an API virConnectGetAllDomainStats that allows fetching all stats and domain status info for all domains in one API call, which will definitely can definitely reduce a lot of the remaining polling we do in virt-manager.

API: https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectGetAllDomainStats


Python example getting all active domain state+stats in one go:

$ cat test.py
import libvirt
import pprint

conn = libvirt.open("qemu:///system")
ret = conn.getAllDomainStats(
    libvirt.VIR_DOMAIN_STATS_STATE | libvirt.VIR_DOMAIN_STATS_CPU_TOTAL,
    libvirt.VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE)
pprint.pprint(ret)

$ python test.py 
[(<libvirt.virDomain object at 0x7ff5424b3490>,
  {'cpu.system': 229450000000L,
   'cpu.time': 1136059669906L,
   'cpu.user': 118530000000L,
   'state.reason': 1,
   'state.state': 1}),
 (<libvirt.virDomain object at 0x7ff5424b34d0>,
  {'cpu.system': 2088720000000L,
   'cpu.time': 7899984603220L,
   'cpu.user': 28280000000L,
   'state.reason': 1,
   'state.state': 1})]

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