summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-07-02 13:36:39 +0000
committerGerrit Code Review <review@openstack.org>2020-07-02 13:36:39 +0000
commit19d7b80d3c1ac9998e0f81361510dd4376aa11ad (patch)
treed6916091dcc33a1f4e51a33f7ceb100fb1266153
parentfff4ac26d9256c290371d1441b89f67a2a7100d0 (diff)
parent72ba11ac28199c47f03829173882275bf577958f (diff)
downloadironic-python-agent-19d7b80d3c1ac9998e0f81361510dd4376aa11ad.tar.gz
Merge "Extend retries to 9, 10 seconds apart." into stable/train
-rw-r--r--ironic_python_agent/config.py4
-rw-r--r--ironic_python_agent/tests/unit/extensions/test_standby.py8
-rw-r--r--releasenotes/notes/extend-retry-timeout-30c930a33d97c193.yaml8
3 files changed, 16 insertions, 4 deletions
diff --git a/ironic_python_agent/config.py b/ironic_python_agent/config.py
index 9c3ade97..41216ff3 100644
--- a/ironic_python_agent/config.py
+++ b/ironic_python_agent/config.py
@@ -235,12 +235,12 @@ cli_opts = [
help='The connection timeout (in seconds) when downloading '
'an image. Does not affect the whole download.'),
cfg.IntOpt('image_download_connection_retries', min=0,
- default=APARAMS.get('ipa-image-download-connection-retries', 2),
+ default=APARAMS.get('ipa-image-download-connection-retries', 9),
help='How many times to retry the connection when downloading '
'an image. Also retries on failure HTTP statuses.'),
cfg.IntOpt('image_download_connection_retry_interval', min=0,
default=APARAMS.get(
- 'ipa-image-download-connection-retry-interval', 5),
+ 'ipa-image-download-connection-retry-interval', 10),
help='Interval (in seconds) between two attempts to establish '
'connection when downloading an image.'),
diff --git a/ironic_python_agent/tests/unit/extensions/test_standby.py b/ironic_python_agent/tests/unit/extensions/test_standby.py
index 394c2bb1..73e543f4 100644
--- a/ironic_python_agent/tests/unit/extensions/test_standby.py
+++ b/ironic_python_agent/tests/unit/extensions/test_standby.py
@@ -399,6 +399,7 @@ class TestStandbyExtension(base.IronicAgentTest):
@mock.patch('requests.get', autospec=True)
def test_download_image_bad_status(self, requests_mock):
+ self.config(image_download_connection_retry_interval=0)
image_info = _build_fake_image_info()
response = requests_mock.return_value
response.status_code = 404
@@ -1157,6 +1158,7 @@ class TestStandbyExtension(base.IronicAgentTest):
return self
self.config(image_download_connection_timeout=1)
+ self.config(image_download_connection_retries=2)
self.config(image_download_connection_retry_interval=0)
image_info = _build_fake_image_info()
file_mock = mock.Mock()
@@ -1287,6 +1289,7 @@ class TestImageDownload(base.IronicAgentTest):
@mock.patch('time.sleep', autospec=True)
def test_download_image_retries(self, sleep_mock, requests_mock,
time_mock):
+ self.config(image_download_connection_retries=2)
response = requests_mock.return_value
response.status_code = 500
response.text = 'Oops'
@@ -1303,7 +1306,7 @@ class TestImageDownload(base.IronicAgentTest):
stream=True, proxies={},
timeout=60)
self.assertEqual(3, requests_mock.call_count)
- sleep_mock.assert_called_with(5)
+ sleep_mock.assert_called_with(10)
self.assertEqual(2, sleep_mock.call_count)
@mock.patch('time.sleep', autospec=True)
@@ -1328,7 +1331,7 @@ class TestImageDownload(base.IronicAgentTest):
stream=True, proxies={},
timeout=60)
self.assertEqual(3, requests_mock.call_count)
- sleep_mock.assert_called_with(5)
+ sleep_mock.assert_called_with(10)
self.assertEqual(2, sleep_mock.call_count)
def test_download_image_and_checksum(self, requests_mock, md5_mock):
@@ -1428,6 +1431,7 @@ foobar irrelevant file.img
standby.ImageDownload, image_info)
def test_download_image_and_checksum_failed(self, requests_mock, md5_mock):
+ self.config(image_download_connection_retry_interval=0)
content = ['SpongeBob', 'SquarePants']
cs_response = mock.Mock()
cs_response.status_code = 400
diff --git a/releasenotes/notes/extend-retry-timeout-30c930a33d97c193.yaml b/releasenotes/notes/extend-retry-timeout-30c930a33d97c193.yaml
new file mode 100644
index 00000000..0870eb6b
--- /dev/null
+++ b/releasenotes/notes/extend-retry-timeout-30c930a33d97c193.yaml
@@ -0,0 +1,8 @@
+---
+fixes:
+ - |
+ Fixes the short timeout retries interval, which was previously ``5``
+ seconds, to a length that will allow the agent to retry after a
+ network interruption. The time between retries is now ``10`` seconds,
+ and the number of retries are set to ``9`` to help ensure intermittent
+ network outages do not cause recoverable failures.