diff options
| author | Brent Eagles <beagles@redhat.com> | 2013-06-14 13:21:54 -0230 |
|---|---|---|
| committer | Brent Eagles <beagles@redhat.com> | 2013-06-25 11:33:27 -0230 |
| commit | 8f3b3db9b04bb5ff7b9486dc6fc211745b983855 (patch) | |
| tree | d25492d53a2f6b99daaa08f12e05d8f1c88dcbbd /nova/tests | |
| parent | 328b347cd058f1c87d7e32a18d9decc0ba517266 (diff) | |
Skip security group code when there is no network.
This patch adds a simple check to the nova/quantum API that immediately
returns an empty list if there are no configured networks available.
Fixes bug 1191044
Change-Id: I34ac4dd56c71f99c7ed9ff632d6dc7036d91008d
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/network/test_quantumv2.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/nova/tests/network/test_quantumv2.py b/nova/tests/network/test_quantumv2.py index 0b6f184ae..b8cadc8d6 100644 --- a/nova/tests/network/test_quantumv2.py +++ b/nova/tests/network/test_quantumv2.py @@ -607,6 +607,19 @@ class TestQuantumv2(test.TestCase): self._allocate_for_instance(net_idx=1, requested_networks=requested_networks) + def test_allocate_for_instance_no_networks(self): + """verify the exception thrown when there are no networks defined.""" + api = quantumapi.API() + self.moxed_client.list_networks( + tenant_id=self.instance['project_id'], + shared=False).AndReturn( + {'networks': []}) + self.moxed_client.list_networks(shared=True).AndReturn( + {'networks': []}) + self.mox.ReplayAll() + nwinfo = api.allocate_for_instance(self.context, self.instance) + self.assertEqual(len(nwinfo), 0) + def test_allocate_for_instance_ex1(self): """verify we will delete created ports if we fail to allocate all net resources. |
