[libvirt-users] Guest interface info under ESX driver

Sengor sengork at gmail.com
Mon Jan 31 13:11:17 UTC 2011


Hi Justin,

Thanks. I did come across that post, but was hoping there'd be a more
contained method of finding the domain's IP address without needing to
do ARP/MAC lookups or query the DHCP server itself.

The following does not display the IP either for an ESX guest 'testvm':
virsh # dumpxml testvm
...
    <interface type='bridge'>
      <mac address='00:0c:29:09:ab:2c'/>
      <source bridge='VM Network'/>
    </interface>
...

Looking around the libvirt Python bindings reveals class virInterface
from lib/site-packages/libvirt.py with the following function:
    def XMLDesc(self, flags):
        """VIR_INTERFACE_XML_INACTIVE - return the static configuration,
                                          suitable for use redefining the
                                          interface via virInterfaceDefineXML()

        Provide an XML description of the interface. If
        VIR_INTERFACE_XML_INACTIVE is set, the description may be reused
        later to redefine the interface with virInterfaceDefineXML(). If it
        is not set, the ip address and netmask will be the current live
        setting of the interface, not the settings from the config files. """
        ret = libvirtmod.virInterfaceGetXMLDesc(self._o, flags)
        if ret is None: raise libvirtError ('virInterfaceGetXMLDesc()
failed', net=self)
        return ret

This looks promising (if it indeed does work for ESX driver), however
I've not figured out how to use this particular class/function yet. So
far unable to find any examples on the web...

Lastly I cannot tell whether this is supported at all for the ESX
driver given the current driver support matrix:
http://www.libvirt.org/hvsupport.html

Any help is appreciated.


On Mon, Jan 31, 2011 at 4:22 PM, Justin Clift <jclift at redhat.com> wrote:
> On 30/01/2011, at 11:19 PM, Sengor wrote:
>> Hi,
>>
>> Is there a way to fetch the current IP address of a running guest
>> domain (with VMware Tools installed) running on an ESX host?
>>
>> Ideally this would be doable via the libvirt Python bindings.
>
> Hi Sengor,
>
> Does this help?
>
>  https://rwmj.wordpress.com/2010/10/26/tip-find-the-ip-address-of-a-virtual-machine/
>
> I'm unsure about it's interaction with vSphere/ESX though.
>
> Regards and best wishes,
>
> Justin Clift



-- 
sengork




More information about the libvirt-users mailing list