summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-30 20:26:44 +0000
committerGerrit Code Review <review@openstack.org>2013-01-30 20:26:44 +0000
commitda98bb63d452bcbdecfd5762bdd893b3ffcf70e8 (patch)
tree461ab04b9ab629489711eeaa28d46436adfa7471
parent67ec659ef88de1d3bf47264ba9ed1d665fc40e4b (diff)
parenta4fd9df8723b6647a79e3e9a5abdd076ba0c5363 (diff)
downloadnova-da98bb63d452bcbdecfd5762bdd893b3ffcf70e8.tar.gz
nova-da98bb63d452bcbdecfd5762bdd893b3ffcf70e8.tar.xz
nova-da98bb63d452bcbdecfd5762bdd893b3ffcf70e8.zip
Merge "Fix rendering of FixedIpNotFoundForNetworkHost"
-rw-r--r--nova/db/sqlalchemy/api.py2
-rw-r--r--nova/tests/test_db_api.py19
2 files changed, 20 insertions, 1 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index 61f27f31c..ad7e4f21f 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -1244,7 +1244,7 @@ def fixed_ip_get_by_network_host(context, network_id, host):
first()
if not result:
- raise exception.FixedIpNotFoundForNetworkHost(network_uuid=network_id,
+ raise exception.FixedIpNotFoundForNetworkHost(network_id=network_id,
host=host)
return result
diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py
index 4485be4f9..684f9fded 100644
--- a/nova/tests/test_db_api.py
+++ b/nova/tests/test_db_api.py
@@ -1510,6 +1510,25 @@ class MigrationTestCase(test.TestCase):
self.assertEqual(migration['instance_uuid'], instance['uuid'])
+class TestFixedIPGetByNetworkHost(test.TestCase):
+ def test_not_found_exception(self):
+ ctxt = context.get_admin_context()
+
+ self.assertRaises(
+ exception.FixedIpNotFoundForNetworkHost,
+ db.fixed_ip_get_by_network_host,
+ ctxt, 1, 'ignore')
+
+ def test_fixed_ip_found(self):
+ ctxt = context.get_admin_context()
+ db.fixed_ip_create(ctxt, dict(network_id=1, host='host'))
+
+ fip = db.fixed_ip_get_by_network_host(ctxt, 1, 'host')
+
+ self.assertEquals(1, fip['network_id'])
+ self.assertEquals('host', fip['host'])
+
+
class TestIpAllocation(test.TestCase):
def setUp(self):