From 005b9950ac84bf3ae06c24ee018f192064060428 Mon Sep 17 00:00:00 2001 From: David Peraza Date: Thu, 2 May 2013 18:59:30 +0000 Subject: Being more defensive around the use_ipv6 config option fixes bug 1175725 Will allow for the flag to be set to filter out ipv6 if configured but will not add ipv6 to template if ipv6 is not configured in quantum. This will allow spwan to continue working in the case where ipv6 is not configured but flag use_ipv6 is set in nova. Change-Id: I26ebdff81efcdeff827521cec247d2c443a5e0ad --- nova/virt/netutils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nova/virt/netutils.py b/nova/virt/netutils.py index 1277251b5..d38197948 100644 --- a/nova/virt/netutils.py +++ b/nova/virt/netutils.py @@ -90,7 +90,8 @@ def get_injected_network_template(network_info, use_ipv6=CONF.use_ipv6, address_v6 = None gateway_v6 = None netmask_v6 = None - if use_ipv6: + ipv6_is_available = use_ipv6 and 'ip6s' in mapping + if ipv6_is_available: address_v6 = mapping['ip6s'][0]['ip'] netmask_v6 = mapping['ip6s'][0]['netmask'] gateway_v6 = mapping['gateway_v6'] @@ -116,4 +117,4 @@ def get_injected_network_template(network_info, use_ipv6=CONF.use_ipv6, ifc_template = open(template).read() return str(Template(ifc_template, searchList=[{'interfaces': nets, - 'use_ipv6': use_ipv6}])) + 'use_ipv6': ipv6_is_available}])) -- cgit