diff options
| author | Hans Lindgren <hanlind@kth.se> | 2013-03-19 21:33:21 +0100 |
|---|---|---|
| committer | Hans Lindgren <hanlind@kth.se> | 2013-03-19 23:53:20 +0100 |
| commit | c1d78cc4f8f4467b8c9ef59b0db2153fe095da09 (patch) | |
| tree | 66f81e7c27d319374b10924acb3280a7a5aa4dfb /nova/tests | |
| parent | 07694d4ffa2b64b7cb21d76af70b8f0df1166915 (diff) | |
List InstanceNotFound as a client exception
get_instance_nw_info() in nova.network.manager should list
InstanceNotFound as a client exception for rpc. This to prevent the
rpc layer from logging a traceback when this exception is raised.
This is an expected type of exception that should be left to the
client to handle.
Resolves bug 1157411.
Change-Id: I6735fb8a386f2256ac8af0ce7fdb36ef7a00b6ce
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/network/test_manager.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/nova/tests/network/test_manager.py b/nova/tests/network/test_manager.py index 2fe53968b..c4ce649f0 100644 --- a/nova/tests/network/test_manager.py +++ b/nova/tests/network/test_manager.py @@ -1222,6 +1222,18 @@ class CommonNetworkTestCase(test.TestCase): def fake_create_fixed_ips(self, context, network_id, fixed_cidr=None): return None + def test_get_instance_nw_info_client_exceptions(self): + manager = network_manager.NetworkManager() + self.mox.StubOutWithMock(manager.db, + 'virtual_interface_get_by_instance') + manager.db.virtual_interface_get_by_instance( + self.context, FAKEUUID).AndRaise(exception.InstanceNotFound( + instance_id=FAKEUUID)) + self.mox.ReplayAll() + self.assertRaises(rpc_common.ClientException, + manager.get_instance_nw_info, + self.context, FAKEUUID, 'fake_rxtx_factor', HOST) + def test_deallocate_for_instance_passes_host_info(self): manager = fake_network.FakeNetworkManager() db = manager.db |
