From c1d78cc4f8f4467b8c9ef59b0db2153fe095da09 Mon Sep 17 00:00:00 2001 From: Hans Lindgren Date: Tue, 19 Mar 2013 21:33:21 +0100 Subject: 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 --- nova/tests/network/test_manager.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'nova/tests') 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 -- cgit