On Sun, Jan 17, 2010 at 5:02 AM, Daniel P. Berrange <berrange(a)redhat.com>wrote:
On Fri, Jan 15, 2010 at 11:52:09AM -0800, su disheng wrote:
> Seem there is no way to get host CPU usage in libvirt API? I can get
> freeMemory by virNodeGetFreeMemory, but no cpu usage API.
> How about add a new api for it? The host CPU usage is also important for
VM
> creation and migration decision, like the free memory.
> Yes, I know, I can got it from "top"...:)
We've historically thought that monitoring of the host OS is out of
scope of the libvirt API, since there are already a huge variety of
monitoring services / APIs available for people. I wonder if we need
to reconsider that now we have the VMWare drivers though - apps using
libvirt don't get to installl stuff in VMWare host OS, so the only
access to some of this host CPU data is probably via the VMWare APIs.
Which in turn suggests we'd need to expose some minimal hosting API
for this in libvirt
Like this happened in the future, one APIs for both host and guest.
Especially, for KVM,
there is no much difference to get the both host and guest, cpu/disk/nic
statistic data.
FWIW, virt-top/virt-manager calculates host CPU usage by summing the
usage
of all guests over a fixed time slice. This will be an underestimate of
true host utilization though, since it can't see CPU usage for non-guest
related processes
For Xen like hypervisors, by summing the usage of all guests is OK, but for
KVM, it's
better to include other non-guest related processes.