diff options
author | Ilya Alekseyev <ialekseev@griddynamics.com> | 2011-03-24 21:26:11 +0000 |
---|---|---|
committer | Tarmac <> | 2011-03-24 21:26:11 +0000 |
commit | aeb0f59b71ad6f3a8eb5d649e23a22838937242f (patch) | |
tree | 01c549ab03d390ce2f852e0deac3e4f1db477137 /nova/utils.py | |
parent | 823df3b0ee7e7eb35e5864bfa235e686819df13e (diff) | |
parent | c3b98443263de944aa54ae4948330b6cfb9a02a6 (diff) | |
download | nova-aeb0f59b71ad6f3a8eb5d649e23a22838937242f.tar.gz nova-aeb0f59b71ad6f3a8eb5d649e23a22838937242f.tar.xz nova-aeb0f59b71ad6f3a8eb5d649e23a22838937242f.zip |
libvirt driver multi_nic support. In this phase libvirt can work with and without multi_nic support, as in multi_nic support for xenapi: https://code.launchpad.net/~tr3buchet/nova/xs_multi_nic/+merge/53458
Diffstat (limited to 'nova/utils.py')
-rw-r--r-- | nova/utils.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/nova/utils.py b/nova/utils.py index 2f568f739..465f81250 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -311,11 +311,15 @@ def get_my_linklocal(interface): def to_global_ipv6(prefix, mac): - mac64 = netaddr.EUI(mac).eui64().words - int_addr = int(''.join(['%02x' % i for i in mac64]), 16) - mac64_addr = netaddr.IPAddress(int_addr) - maskIP = netaddr.IPNetwork(prefix).ip - return (mac64_addr ^ netaddr.IPAddress('::0200:0:0:0') | maskIP).format() + try: + mac64 = netaddr.EUI(mac).eui64().words + int_addr = int(''.join(['%02x' % i for i in mac64]), 16) + mac64_addr = netaddr.IPAddress(int_addr) + maskIP = netaddr.IPNetwork(prefix).ip + return (mac64_addr ^ netaddr.IPAddress('::0200:0:0:0') | maskIP).\ + format() + except TypeError: + raise TypeError(_("Bad mac for to_global_ipv6: %s") % mac) def to_mac(ipv6_address): |