summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-03-28 12:35:39 +0000
committerGerrit Code Review <review@openstack.org>2013-03-28 12:35:40 +0000
commitf281afd2ba30c6efa0fb64737a5cb93e1dd28b8c (patch)
treec9828db089048b7c7a30726044685a15fbe34375
parent9a2468f65bfd634f718a9d4500972a4e30c15a13 (diff)
parent57689f26f37fe3de33a666a2d7d0731eae9c7ea9 (diff)
Merge "Fix quantum nic allocation when only portid is specified"
-rw-r--r--nova/network/quantumv2/api.py3
-rw-r--r--nova/tests/network/test_quantumv2.py7
2 files changed, 9 insertions, 1 deletions
diff --git a/nova/network/quantumv2/api.py b/nova/network/quantumv2/api.py
index fe4f6586a..a23a119b8 100644
--- a/nova/network/quantumv2/api.py
+++ b/nova/network/quantumv2/api.py
@@ -289,7 +289,8 @@ class API(base.Base):
# this only affects the attach case, not the original use for this
# method.
return network_model.NetworkInfo([port for port in nw_info
- if port['id'] in created_port_ids])
+ if port['id'] in created_port_ids +
+ touched_port_ids])
def _refresh_quantum_extensions_cache(self):
if (not self.last_quantum_extension_sync or
diff --git a/nova/tests/network/test_quantumv2.py b/nova/tests/network/test_quantumv2.py
index be5d53455..991a0149a 100644
--- a/nova/tests/network/test_quantumv2.py
+++ b/nova/tests/network/test_quantumv2.py
@@ -514,6 +514,13 @@ class TestQuantumv2(test.TestCase):
# port.
self._allocate_for_instance(1, macs=set(['ab:cd:ef:01:23:45']))
+ def test_allocate_for_instance_accepts_only_portid(self):
+ # Make sure allocate_for_instance works when only a portid is provided
+ self._returned_nw_info = self.port_data1
+ result = self._allocate_for_instance(
+ requested_networks=[(None, None, 'my_portid1')])
+ self.assertEqual(self.port_data1, result)
+
def test_allocate_for_instance_not_enough_macs_via_ports(self):
# using a hypervisor MAC via a pre-created port will stop it being
# used to dynamically create a port on a network. We put the network