From 673f3118b6b558f8c23a669ad6aae1cf8df6632e Mon Sep 17 00:00:00 2001 From: Chris Yeoh Date: Wed, 17 Apr 2013 10:02:33 +0930 Subject: Translate cinder NotFound exception When we attempt to get information about a snapshot which doesn't exist we get a cinder NotFound exception. However, this is not caught and causes a stacktrace in the logs. This occurs on every tempest run in the test EC2VolumesTest.test_create_volume_from_snapshot. The fix is to translate the exception to SnapshotNotFound which is handled correctly further up the call chain. Fixes bug 1169777 Part of blueprint no-stacktraces-in-logs Change-Id: If893b5083b93894e671c978bd23bd89d3d017531 --- nova/tests/volume/test_cinder.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'nova/tests') diff --git a/nova/tests/volume/test_cinder.py b/nova/tests/volume/test_cinder.py index 78d2602cc..420fa2373 100644 --- a/nova/tests/volume/test_cinder.py +++ b/nova/tests/volume/test_cinder.py @@ -229,6 +229,14 @@ class CinderApiTestCase(test.TestCase): self.api.get_snapshot(self.ctx, snapshot_id) + def test_get_snapshot_failed(self): + snapshot_id = 'snapshot_id' + cinder.cinderclient(self.ctx).AndRaise(cinder_exception.NotFound('')) + self.mox.ReplayAll() + + self.assertRaises(exception.SnapshotNotFound, + self.api.get_snapshot, self.ctx, snapshot_id) + def test_get_all_snapshots(self): cinder.cinderclient(self.ctx).AndReturn(self.cinderclient) cinder._untranslate_snapshot_summary_view(self.ctx, -- cgit