Fedora Account System
Red Hat Associate
Red Hat Customer
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})]
This is in: commit 68a5abe27971d8273e13bb8d846cdaa5f17c3ae4 Author: Simon Kobyda <skobyda> Date: Fri Oct 5 16:54:25 2018 +0200 statsmanager: new class for VM/conn stats polling And following commits