[Libvir] More queries

Katti, Vadiraj (STSD-Openview) vadiraj.katti at hp.com
Mon Dec 17 11:54:08 UTC 2007


"Xm uptime" gives the uptime of all the domains running. So I believe
there should be a way to get it.
I'm trying to find what interface xm uses. Will update the group once I
get more insight.
 

-----Original Message-----
From: Richard W.M. Jones [mailto:rjones at redhat.com] 
Sent: Thursday, December 13, 2007 9:06 PM
To: Katti, Vadiraj (STSD-Openview)
Cc: libvir-list at redhat.com
Subject: Re: [Libvir] More queries

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




More information about the libvir-list mailing list