[Libvir] More queries

Daniel P. Berrange berrange at redhat.com
Thu Dec 13 16:45:26 UTC 2007


On Thu, Dec 13, 2007 at 03:35:44PM +0000, Richard W.M. Jones wrote:
> 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.

It is not available from the HV - the HV has no concept of real world
time.

> >	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?".

And guests can have multiple IP address. They can have IPv4 and IPv6
address. They can even have the same addresses under some scenarios
(clustering)


Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list