[libvirt] [PATCH 2/2] util: introduce virSocketAddrParseAny
John Ferlan
jferlan at redhat.com
Thu Mar 29 17:27:18 UTC 2018
On 03/26/2018 04:29 PM, Jim Fehlig wrote:
> When preparing for migration, the libxl driver creates a new TCP listen
> socket for the incoming migration by calling virNetSocketNewListenTCP,
> passing the destination host name. virNetSocketNewListenTCP calls
> virSocketAddrParse to check if the host name is a wildcard address, in
> which case it avoids adding the AI_ADDRCONFIG flag to the hints passed to
> getaddrinfo. If the host name is not an IP address, virSocketAddrParse
> reports an error
>
> error : virSocketAddrParseInternal:121 : Cannot parse socket address
> 'myhost.example.com': Name or service not known
>
> But virNetSocketNewListenTCP succeeds regardless and the overall migration
> operation succeeds.
>
> Introduce virSocketAddrParseAny and use it when simply testing if a host
> name/addr is parsable.
>
> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
> ---
>
> Essentially a V2 of
>
> https://www.redhat.com/archives/libvir-list/2018-March/msg01120.html
>
> It takes a slightly different approach by creating a function that can
> parse host names or IP addresses.
>
> src/libvirt_private.syms | 1 +
> src/rpc/virnetsocket.c | 2 +-
> src/util/virsocketaddr.c | 50 +++++++++++++++++++++++++++++++++++++++++++++---
> src/util/virsocketaddr.h | 5 +++++
> 4 files changed, 54 insertions(+), 4 deletions(-)
>
Reviewed-by: John Ferlan <jferlan at redhat.com>
Wait for 4.2.0 for this one...
John
BTW: Your call on whether to add to the new API comments something about
the API could be susceptible to a delay due to network name resolution
lookup pause. That is, from the getaddrinfo man page:
"The AI_NUMERICHOST flag suppresses any potentially lengthy network host
address lookups."
More information about the libvir-list
mailing list