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

Re: [libvirt] Host IP Address



Thanks Max,

Thanks for such a quick reply.

Did I get you right, that you have a 'virDomainPtr' as basis and want a mapping
from that to the IP?
Yes. Thats what I want to do.

I guess one way could be to get the virConnectionPtr
 conn_ptr = virDomainGetConnect (domain_ptr);

And then query the hostname
 virConnectGetHostname (conn_ptr);
or the uri
 virConnectGetURI (conn_ptr);

and resolve the hostname or extract the IP/host from the URI and
resolve that.

Yes, I thought of this too. But I was hoping that the LibvirtAPI has some way of giving me the host IP Address directly, instead of resolving it myself. But then again, how would I resolve the IP Address from the hostname? Can you please guide me on this.

Thanks and Regards
Sagar Barve

----- Original Message ----- From: "Maximilian Wilhelm" <max rfc2324 org>
To: <libvir-list redhat com>
Sent: Wednesday, June 23, 2010 3:26 PM
Subject: Re: [libvirt] Host IP Address


Anno domini 2010 IKI-サガル バルウェ scripsit:

Hi!

I was trying to figure out a way to get the IP Address of the host, in which
a particular VM is running using the LibvirtAPI. For Eg.; If I have a VM
object, then I would like to fetch the IP Address of the host in which this
VM is running, programatically.
Is there a way to do this using the API?

Please guide me, if there is some other way to do this also.

Did I get you right, that you have a 'virDomainPtr' as basis and want a mapping
from that to the IP?

I guess one way could be to get the virConnectionPtr
 conn_ptr = virDomainGetConnect (domain_ptr);

And then query the hostname
 virConnectGetHostname (conn_ptr);
or the uri
 virConnectGetURI (conn_ptr);

and resolve the hostname or extract the IP/host from the URI and
resolve that.

HTH
Ciao
Max
--
Gib Dein Bestes. Dann übertriff Dich selbst!

--
libvir-list mailing list
libvir-list redhat com
https://www.redhat.com/mailman/listinfo/libvir-list


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