[libvirt] [PATCH 1/4] util: introduce a new helper for get interface IPv6 address

lhuang lhuang at redhat.com
Thu Feb 26 10:24:18 UTC 2015


On 02/25/2015 11:55 PM, Laine Stump wrote:
> On 02/25/2015 04:50 AM, lhuang wrote:
>>
>> And i also thought about another issue after your reminding: An
>> interface can have more than one IPv6 address. But i still couldn't
>> find a good way until now to chose which IPv6 address if we find more
>> than one IPv6 address in one interface (maybe users should use "listen
>> type=address" instead of "listen type=network" in this case ;)).
>>
>> There are some special addresses anddefault address selection for IPv6
>> address, i don't know if it is a good idea to guess which address is
>> the caller really desired if we get some IPv6 address in one interface.
> If they are using listen type='network', then either they will have
> taken care to have the network only have a single IP, or they won't
> care. Otherwise, as you say, they should use listen type='address'.

Yes, this is what i thought at the first time, thanks for your help.
> BTW, some history for listen type='network' - this feature was added to
> allow a way to remove the explicit listen address from the domain
> config, thus allowing the domain to be migrated from one host to
> another, as long as there is a network with the same name on both hosts.
> Often the network used for this is created only for this purpose. If the
> physical interface named in the network has multiple IP addresses, there
> really isn't a good way for libvirt to indicate preference for any one
> of the addresses over another (you can't specify it with an index,
> because the index of the desired IP address may be different between the
> hosts. Because it's impossible to do it right, I say we shouldn't even
> try; it would be worse for it to work halfway.
>

Okay, got it, so maybe report error if host physical interface has 
multiple IP addresses will be a good choice in this scene, but i found a 
host physical interface will have 2 Ipv6 address, one is 2001...or 
2002... for public and another fe80... address for internal.

just like this:
     inet6 2001:db8:ca2:2::1/64 scope global
        valid_lft forever preferred_lft forever
     inet6 fe80::5054:ff:fe7f:f047/64 scope link
        valid_lft forever preferred_lft forever

i think maybe we can use 2001... ipv6 address instead of output error in 
this scene ?


Luyao




More information about the libvir-list mailing list