diff options
| author | Dan Smith <danms@us.ibm.com> | 2013-03-27 14:45:06 -0700 |
|---|---|---|
| committer | Dan Smith <danms@us.ibm.com> | 2013-03-27 14:45:06 -0700 |
| commit | 57689f26f37fe3de33a666a2d7d0731eae9c7ea9 (patch) | |
| tree | fc5ef5fc6a079ae18a9963f7cfec201ed9ea88e4 /nova/tests | |
| parent | 0bf532237382360666499e4c568f0a161ff31afe (diff) | |
Fix quantum nic allocation when only portid is specified
A simple omission at the end of allocate_for_instance() was preventing
the function from returning information about the newly-allocated port
if one was not actually allocated from a network (i.e. if it was
provided as input). This fixes that and adds a test which would have
caught it.
Fixes bug 1160560
Change-Id: Ib0d7d91acfe5bd684cdfc072fe47c8115c2f91b3
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/network/test_quantumv2.py | 7 |
1 files changed, 7 insertions, 0 deletions
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 |
