summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-04-07 00:30:55 +0000
committerGerrit Code Review <review@openstack.org>2013-04-07 00:30:55 +0000
commit147eebe613d5d1756ce4f11066c62474eabb6076 (patch)
tree9b35583e54aa5a899cd721717686489f689dc3c9
parenta660e30bb80b2082644d5824735b123aeec7df74 (diff)
parentc62f698ef1f1e69bd5eb3c6544ee305f96488d42 (diff)
downloadnova-147eebe613d5d1756ce4f11066c62474eabb6076.tar.gz
nova-147eebe613d5d1756ce4f11066c62474eabb6076.tar.xz
nova-147eebe613d5d1756ce4f11066c62474eabb6076.zip
Merge "Cannot boot vm if quantum plugin does not support L3 api"
-rw-r--r--nova/network/quantumv2/api.py10
-rw-r--r--nova/tests/network/test_quantumv2.py12
2 files changed, 21 insertions, 1 deletions
diff --git a/nova/network/quantumv2/api.py b/nova/network/quantumv2/api.py
index a23a119b8..3a6870d6e 100644
--- a/nova/network/quantumv2/api.py
+++ b/nova/network/quantumv2/api.py
@@ -720,7 +720,15 @@ class API(base.Base):
def _get_floating_ips_by_fixed_and_port(self, client, fixed_ip, port):
"""Get floatingips from fixed ip and port."""
- data = client.list_floatingips(fixed_ip_address=fixed_ip, port_id=port)
+ try:
+ data = client.list_floatingips(fixed_ip_address=fixed_ip,
+ port_id=port)
+ # If a quantum plugin does not implement the L3 API a 404 from
+ # list_floatingips will be raised.
+ except quantumv2.exceptions.QuantumClientException as e:
+ if e.status_code == 404:
+ return []
+ raise
return data['floatingips']
def release_floating_ip(self, context, address,
diff --git a/nova/tests/network/test_quantumv2.py b/nova/tests/network/test_quantumv2.py
index 991a0149a..6a3b31412 100644
--- a/nova/tests/network/test_quantumv2.py
+++ b/nova/tests/network/test_quantumv2.py
@@ -1210,6 +1210,18 @@ class TestQuantumv2(test.TestCase):
self.mox.ReplayAll()
api.remove_fixed_ip_from_instance(self.context, self.instance, address)
+ def test_list_floating_ips_without_l3_support(self):
+ api = quantumapi.API()
+ QuantumNotFound = quantumv2.exceptions.QuantumClientException(
+ status_code=404)
+ self.moxed_client.list_floatingips(
+ fixed_ip_address='1.1.1.1', port_id=1).AndRaise(QuantumNotFound)
+ self.mox.ReplayAll()
+ quantumv2.get_client('fake')
+ floatingips = api._get_floating_ips_by_fixed_and_port(
+ self.moxed_client, '1.1.1.1', 1)
+ self.assertEqual(floatingips, [])
+
class TestQuantumv2ModuleMethods(test.TestCase):
def test_ensure_requested_network_ordering_no_preference_ids(self):