From dc8aeb49ce4ad6523e3f093fed082f78a6442814 Mon Sep 17 00:00:00 2001 From: Cory Stone Date: Fri, 16 Nov 2012 14:15:06 -0600 Subject: Support cinderclient http retries. HTTP retries were recently added to cinderclient. This adds the config option required to use it. The default (unchanged) behavior is 0 retries. Change-Id: Ia7ad831045e8df9ad9c22f0119ae3485d91ad949 --- nova/tests/test_cinder.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/test_cinder.py b/nova/tests/test_cinder.py index dfdd4f3d7..7b1081b79 100644 --- a/nova/tests/test_cinder.py +++ b/nova/tests/test_cinder.py @@ -97,11 +97,14 @@ class FakeHTTPClient(cinder.cinder_client.client.HTTPClient): class FakeCinderClient(cinder.cinder_client.Client): - def __init__(self, username, password, project_id=None, auth_url=None): + def __init__(self, username, password, project_id=None, auth_url=None, + retries=None): super(FakeCinderClient, self).__init__(username, password, project_id=project_id, - auth_url=auth_url) - self.client = FakeHTTPClient(username, password, project_id, auth_url) + auth_url=auth_url, + retries=retries) + self.client = FakeHTTPClient(username, password, project_id, auth_url, + retries=retries) # keep a ref to the clients callstack for factory's assert_called self.callstack = self.client.callstack = [] @@ -173,3 +176,11 @@ class CinderTestCase(test.TestCase): self.assert_called('GET', '/volumes/5678') self.assertTrue('volume_image_metadata' in volume) self.assertEqual(volume['volume_image_metadata'], _image_metadata) + + def test_cinder_http_retries(self): + retries = 42 + self.flags(cinder_http_retries=retries) + volume = self.api.get(self.context, '1234') + self.assert_called('GET', '/volumes/1234') + self.assertEquals( + self.fake_client_factory.client.client.retries, retries) -- cgit