Merge "Retry image download if it's corrupted" into stable/xena
This commit is contained in:
commit
6f81db2dd6
|
@ -178,7 +178,8 @@ class GlanceClientWrapper(object):
|
|||
kwargs = kwargs or {}
|
||||
retry_excs = (glanceclient.exc.ServiceUnavailable,
|
||||
glanceclient.exc.InvalidEndpoint,
|
||||
glanceclient.exc.CommunicationError)
|
||||
glanceclient.exc.CommunicationError,
|
||||
IOError)
|
||||
num_attempts = 1 + CONF.glance.num_retries
|
||||
controller_name = controller or 'images'
|
||||
|
||||
|
|
|
@ -464,6 +464,20 @@ class TestGlanceClientWrapperRetries(test.NoDBTestCase):
|
|||
client = glance.GlanceClientWrapper()
|
||||
self.assert_retry_attempted(sleep_mock, client, 'https://host2:9293')
|
||||
|
||||
@mock.patch('random.shuffle')
|
||||
@mock.patch('time.sleep')
|
||||
@mock.patch('nova.image.glance._glanceclient_from_endpoint')
|
||||
def test_retry_works_for_corrupted_image(self, create_client_mock,
|
||||
sleep_mock, shuffle_mock):
|
||||
side_effect = [
|
||||
IOError,
|
||||
None
|
||||
]
|
||||
self._mock_client_images_response(create_client_mock, side_effect)
|
||||
self.flags(num_retries=1, group='glance')
|
||||
client = glance.GlanceClientWrapper()
|
||||
self.assert_retry_attempted(sleep_mock, client, 'https://host2:9293')
|
||||
|
||||
@mock.patch('random.shuffle')
|
||||
@mock.patch('time.sleep')
|
||||
@mock.patch('nova.image.glance._glanceclient_from_endpoint')
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
`Bug 1950657 <https://bugs.launchpad.net/nova/+bug/1950657>`_, fixing
|
||||
behavior when nova-compute wouldn't retry image download when gets
|
||||
"Corrupt image download" error from glanceclient and has num_retries
|
||||
config option set.
|
Loading…
Reference in New Issue