Thanks Max,
But then again, how would I resolve the IP Address from the hostname? Can
you please guide me on this.
In short:
struct hostent *hostent;
hostent = gethostbyname (char *hostname);
if (hostent) {
for (i = 0; hostent->h_addr_list[i]; i++)
printf ("%s, ", hostent->h_addr_list[i]);
printf ("\n");
}
I got the idea of what to do. Thanks.
Thanks and Regards
Sagar Barve
----- Original Message -----
From: "Maximilian Wilhelm" <max@xxxxxxxxxxx>
To: <libvir-list@xxxxxxxxxx>
Sent: Wednesday, June 23, 2010 4:23 PM
Subject: Re: Host IP Address
Anno domini 2010 IKI-サガル バルウェ scripsit:
Hi!
Thanks for such a quick reply.
No problem :)
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.
I don't know of any and I wouldn't know which IP to choose if there
were multiple.
But then again, how would I resolve the IP Address from the hostname? Can
you please guide me on this.
In short:
struct hostent *hostent;
hostent = gethostbyname (char *hostname);
if (hostent) {
for (i = 0; hostent->h_addr_list[i]; i++)
printf ("%s, ", hostent->h_addr_list[i]);
printf ("\n");
}
HTH
Ciao
Max
--
"Ich habe eher spontan mitbestellt, ohne genau zu wissen, was ich da
gerade kaufe.
Immer noch besser, als Schuhe zu kaufen."
-- uschebit zum Thema SheevaPlug
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list