summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorHans Lindgren <hanlind@kth.se>2013-03-19 21:33:21 +0100
committerHans Lindgren <hanlind@kth.se>2013-03-19 23:53:20 +0100
commitc1d78cc4f8f4467b8c9ef59b0db2153fe095da09 (patch)
tree66f81e7c27d319374b10924acb3280a7a5aa4dfb /nova/tests
parent07694d4ffa2b64b7cb21d76af70b8f0df1166915 (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.py12
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