[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] IP Address of a domain



On Wed, Jun 16, 2010 at 05:01:03PM +0900, IKI-サガル バルウェ wrote:
> Hello,
> 
> I would like to obtain the IP Address of a domain using the libvirt API.
> 
> I see that the XMLDesc gives the MAC address, but not the IP Address.

This isn't possible via the API. In general the IP address is only known
to the guest OS. You have to resort to playing games like sninffing the
ARP packets to guess what IP the guest has, or setting upa fixed MAC
address <-> IP address mapping in your DHCP server

> I found out that the "vncdisplay" command option from "virsh" command line 
> tool provides the IP Address and port number. How would I obtain this info 
> using libvirt API.

Just look at the source for virsh in tools/virsh.c - search for 'vncdisplay'
there. It basically just gets the data from the XML <display> element.

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]