[Libvir] More queries

Richard W.M. Jones rjones at redhat.com
Thu Dec 13 15:35:44 UTC 2007


Katti, Vadiraj (STSD-Openview) wrote:
> Hi,
>      I've more quries on libvirt apis:
> 	1. Is there any API in libvirt that gives me the uptime of the
> guets.

No there isn't, unfortunately.  Best you can do is to tell how much CPU 
time a guest has used.

I suspect this information is not available from the Xen hypervisor.  If 
it is, then we ought to expose it where possible.

> 	2. Can I know how many physical CPUs are dedicated to a VM or if
> they are shared.

Yes you can tell this by using the terribly complicated 
'virDomainGetVcpus' function.  Read the manual page _very_ carefully for 
this one :-(

virt-top uses this function to display the % used and mapping of VCPUs 
to PCPUs in real time, so you might find playing with virt-top and 
looking at the code useful:
http://hg.et.redhat.com/virt/applications/virt-top--devel?f=e100f86fdf28;file=virt-top/virt_top.ml

> 	3. How do I know the logical cpu consumption of the guests( from
> dom0 using libvirt obviously).

This is sort of possible.  See this page for discussion and limitations 
of the current API:

http://et.redhat.com/~rjones/virt-top/faq.html#pcpu

> 	4. Can get the ip address of each of the guests with any of the
> APIs

No.  Guests can send out packets from their interface using any IP 
address they want.  By convention it's normally set up so that guests 
get an IP address from a DHCP server, but that's only a convention, not 
required.  Imagine rephrasing the question as "Can I get the IP address 
of each machine on my LAN?".

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20071213/108315e1/attachment-0001.bin>


More information about the libvir-list mailing list