> As a hindsight from reviewing 6/7. This function should also be
in
> virsocketaddr.c
>
>
hmmm.. yes I see.. Guess I got hung up on "virSocketAddr..." and didn't
focus as closely on the implementation where virSocketAddrParse can take
NULL as the first parameter... Guess, that means patches 2-5 can just be
called as:
if (virSocketAddrParse(NULL, pool->def->source.hosts[0].name,
AF_UNSPEC) < 0)
Without actually trying it - seemed like a good idea; however, the
virSocketAddrParse uses/sets "hints.ai_flags = AI_NUMERICHOST;" thus
it requires a numeric value and not one that could be a name or a
number, so it seems this particular code cannot use it.
I really see those virSocketAddr* API's as different, very specific
to supporting the network socket's and socket address formats; whereas,
this code will take a string representation of either the name or
the number as provided in the XML and validate it.
I don't think this set of API's belongs there as it's not manipulating
virSocketAddr's.
So, I'll change the function intro to:
* Unlike virGetHostname, this variant of the code receives a hostname and
* retrieves the getaddrinfo. If the passed hostname can be successfully
* resolved via getaddrinfo, then return true; otherwise, if the hostname
* cannot be resolved for any reason, return false.
and
remove the localhost specific checking
and adjust the commit message to remove the 'getnameinfo' reference.
John