[libvirt] [PATCH] Better error reporting for failed migration.

Chris Lalancette clalance at redhat.com
Mon Oct 19 12:41:13 UTC 2009


Daniel P. Berrange wrote:
>> +        if (STREQ(hostname, "localhost")) {
>> +            VIR_FREE(hostname);
>> +            qemudReportError(dconn, NULL, NULL, VIR_ERR_INVALID_ARG, "%s",
>> +                             _("Could not resolve destination hostname; "
>> +                               "either fix destination to resolve hostname, "
>> +                               "or use the optional URI migration parameter"));
>> +            goto cleanup;
>> +        }
>> +
> 
> I think I'd be inclined to actually resolve the hostname, and then
> check it agaist  127.0.0.1  and ::1. You can get quite a few variations
> which ultimtely might point to localhost.

I did some testing here.  Basically I wrote a small program that just calls
getaddrinfo() like virHostname() does, iterates over all of the addresses
returned, and prints various information.

On my F-11 box, due to a possibly glibc bug, it only returns IPv4 addresses, and
the fields look like:

flags 0x82, family 2, socktype 1, protocol 6, addrlen 16, addr 0x1521b80,
canonname intel2.xmen.org
flags 0x82, family 2, socktype 2, protocol 17, addrlen 16, addr 0x1521bd0,
canonname (null)
flags 0x82, family 2, socktype 3, protocol 0, addrlen 16, addr 0x1521c20,
canonname (null)

On my F-12 box, which is the one that originally showed the problems, it shows
both IPv6 and IPv4 addresses, and the output looks like:

flags 0x82, family 10, socktype 1, protocol 6, addrlen 28, addr 0x19ad220,
canonname localhost
flags 0x82, family 10, socktype 2, protocol 17, addrlen 28, addr 0x19ad280,
canonname (null)
flags 0x82, family 10, socktype 3, protocol 0, addrlen 28, addr 0x19ad2e0,
canonname (null)
flags 0x82, family 2, socktype 1, protocol 6, addrlen 16, addr 0x19ad110,
canonname (null)
flags 0x82, family 2, socktype 2, protocol 17, addrlen 16, addr 0x19ad180,
canonname (null)
flags 0x82, family 2, socktype 3, protocol 0, addrlen 16, addr 0x19ad1d0,
canonname (null)

So it seems like the canonname resolves to "localhost" in both the IPv4 (family
2) and IPv6 (family 10) cases.  I guess we could pass the result of
virGetHostname() back into getaddrinfo() and look at the results, but I don't
know that it would be significantly different from what we already get.  Do you
still think it is worthwhile?

-- 
Chris Lalancette




More information about the libvir-list mailing list