<br><br><div class="gmail_quote">On Sun, Jan 17, 2010 at 5:02 AM, Daniel P. Berrange <span dir="ltr"><<a href="mailto:berrange@redhat.com">berrange@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Fri, Jan 15, 2010 at 11:52:09AM -0800, su disheng wrote:<br>
> Seem there is no way to get host CPU usage in libvirt API? I can get<br>
> freeMemory by  virNodeGetFreeMemory, but no cpu usage API.<br>
> How about add a new api for it? The host CPU usage is also important for VM<br>
> creation and migration decision, like the free memory.<br>
> Yes, I know, I can got it from "top"...:)<br>
<br>
</div>We've historically thought that monitoring of the host OS is out of<br>
scope of the libvirt API, since there are already a huge variety of<br>
monitoring services / APIs available for people.  I wonder if we need<br>
to reconsider that now we have the VMWare drivers though - apps using<br>
libvirt don't get to installl stuff in VMWare host OS, so the only<br>
access to some of this host CPU data is probably via the VMWare APIs.<br>
Which in turn suggests we'd need to expose some minimal hosting API<br>
for this in libvirt<br>
<br></blockquote><div><br>Like this happened in the future, one APIs for both host and guest. Especially, for KVM, <br>there is no much difference to get the both host and guest, cpu/disk/nic statistic data.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

FWIW, virt-top/virt-manager calculates host CPU usage by summing the usage<br>
of all guests over a fixed time slice. This will be an underestimate of<br>
true host utilization though, since it can't see CPU usage for non-guest<br>
related processes<br></blockquote><div><br>For Xen like hypervisors, by summing the usage of all guests is OK, but for KVM, it's<br>better to include other non-guest related processes.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div><div></div><div class="h5"><br>
Daniel<br>
--<br>
|: Red Hat, Engineering, London   -o-   <a href="http://people.redhat.com/berrange/" target="_blank">http://people.redhat.com/berrange/</a> :|<br>
|: <a href="http://libvirt.org" target="_blank">http://libvirt.org</a>  -o-  <a href="http://virt-manager.org" target="_blank">http://virt-manager.org</a>  -o-  <a href="http://ovirt.org" target="_blank">http://ovirt.org</a> :|<br>

|: <a href="http://autobuild.org" target="_blank">http://autobuild.org</a>       -o-         <a href="http://search.cpan.org/%7Edanberr/" target="_blank">http://search.cpan.org/~danberr/</a> :|<br>
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|<br>
</div></div></blockquote></div><br>