summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/ipv6/account_identifier.py2
-rw-r--r--nova/tests/test_ipv6.py7
2 files changed, 9 insertions, 0 deletions
diff --git a/nova/ipv6/account_identifier.py b/nova/ipv6/account_identifier.py
index 4ca7b5983..27bb01988 100644
--- a/nova/ipv6/account_identifier.py
+++ b/nova/ipv6/account_identifier.py
@@ -38,6 +38,8 @@ def to_global(prefix, mac, project_id):
raise TypeError(_('Bad mac for to_global_ipv6: %s') % mac)
except TypeError:
raise TypeError(_('Bad prefix for to_global_ipv6: %s') % prefix)
+ except NameError:
+ raise TypeError(_('Bad project_id for to_global_ipv6: %s') % project_id)
def to_mac(ipv6_address):
diff --git a/nova/tests/test_ipv6.py b/nova/tests/test_ipv6.py
index f9c2517a7..5c333b17e 100644
--- a/nova/tests/test_ipv6.py
+++ b/nova/tests/test_ipv6.py
@@ -67,3 +67,10 @@ class IPv6AccountIdentiferTestCase(test.TestCase):
bad_prefix,
'2001:db8::a94a:8fe5:ff33:4455',
'test')
+
+ def test_to_global_with_bad_project(self):
+ bad_project = 'non-existent-project-name'
+ self.assertRaises(TypeError, ipv6.to_global,
+ '2001:db8::',
+ '2001:db8::a94a:8fe5:ff33:4455',
+ bad_project)