From 6bc9c6eff7b58bdc955c35268c50aa536ff8e129 Mon Sep 17 00:00:00 2001 From: Roman Safronov Date: Sun, 15 Jan 2023 19:04:04 +0200 Subject: [PATCH] Allow custom ubuntu timeouts Default timeouts of 900 and 1500 seconds which are suitable for upstream CI are too long for downstream CI causing redundant 15 minutes retries while 2-3 minutes are enough to make a decision that something went wrong. This patch allows configuring custom values for ubuntu vm connectivity timeouts. Change-Id: If33991b0b932d7615f7072a4c2121fde4d5bcdc8 --- infrared_plugin/plugin.spec | 13 +++++++++++++ roles/tobiko-configure/defaults/main.yaml | 7 +++++++ tobiko/openstack/nova/config.py | 11 +++++++++++ tobiko/openstack/stacks/_nova.py | 10 +++++++--- tobiko/openstack/stacks/_ubuntu.py | 8 +++++--- 5 files changed, 43 insertions(+), 6 deletions(-) diff --git a/infrared_plugin/plugin.spec b/infrared_plugin/plugin.spec index 129003fdd..c42009f59 100644 --- a/infrared_plugin/plugin.spec +++ b/infrared_plugin/plugin.spec @@ -250,6 +250,19 @@ subparsers: help: Skip Swift containers healthchecks when CephAdm is deployed ansible_variable: ceph_rgw default: False + ubuntu-connection-timeout: + type: Value + help: | + Timeout error is raised if a connection to an ubuntu instance + is not successful before it expires + ansible_variable: ubuntu_connection_timeout + ubuntu-is-reachable-timeout: + type: Value + help: | + Timeout error is raised if an ubuntu instance is not reachable + before it expires + ansible_variable: ubuntu_is_reachable_timeout + - title: Cleanup stage options: diff --git a/roles/tobiko-configure/defaults/main.yaml b/roles/tobiko-configure/defaults/main.yaml index 502ea823c..0e6fd27de 100644 --- a/roles/tobiko-configure/defaults/main.yaml +++ b/roles/tobiko-configure/defaults/main.yaml @@ -17,6 +17,10 @@ test_default_conf: has_external_load_balancer: "{{ has_external_load_balancer }}" ceph_rgw: "{{ ceph_rgw }}" + nova: + ubuntu_connection_timeout: "{{ ubuntu_connection_timeout }}" + ubuntu_is_reachable_timeout: "{{ ubuntu_is_reachable_timeout }}" + test_log_debug: '' test_case_timeout: 1800. @@ -33,3 +37,6 @@ has_external_load_balancer: '' overcloud_ssh_username: '' ceph_rgw: '' + +ubuntu_connection_timeout: '' +ubuntu_is_reachable_timeout: '' diff --git a/tobiko/openstack/nova/config.py b/tobiko/openstack/nova/config.py index 66710b74e..d8126131a 100644 --- a/tobiko/openstack/nova/config.py +++ b/tobiko/openstack/nova/config.py @@ -28,6 +28,17 @@ OPTIONS = [ cfg.StrOpt('key_type', default=DEFAULT_KEY_TYPE, help="Default SSH key type to login to server instances"), + cfg.FloatOpt('ubuntu_connection_timeout', + default=1500., + help="Timeout (in seconds) for establishing connection " + "to ubuntu"), + cfg.FloatOpt('ubuntu_is_reachable_timeout', + default=900., + help="Timeout (in seconds) till ubuntu server is reachable"), + cfg.FloatOpt('cloudinit_is_reachable_timeout', + default=600., + help="Timeout (in seconds) till cloud-init based server is " + "reachable") ] diff --git a/tobiko/openstack/stacks/_nova.py b/tobiko/openstack/stacks/_nova.py index 4f84e2746..56fed5116 100644 --- a/tobiko/openstack/stacks/_nova.py +++ b/tobiko/openstack/stacks/_nova.py @@ -388,7 +388,9 @@ class ServerStackFixture(heat.HeatStackFixture, abc.ABC): requirements['port'] += 1 return requirements - is_reachable_timeout: tobiko.Seconds = None + @property + def is_reachable_timeout(self) -> tobiko.Seconds: + return None def assert_is_reachable(self, ssh_client: ssh.SSHClientType = None, @@ -422,8 +424,10 @@ class CloudInitServerStackFixture(ServerStackFixture, ABC): #: nax SWAP file size in bytes swap_maxsize: typing.Optional[int] = None - # I expect cloud-init based servers to be slow to boot - is_reachable_timeout: tobiko.Seconds = 600. + @property + def is_reachable_timeout(self) -> tobiko.Seconds: + # I expect cloud-init based servers to be slow to boot + return CONF.tobiko.nova.cloudinit_is_reachable_timeout @property def user_data(self): diff --git a/tobiko/openstack/stacks/_ubuntu.py b/tobiko/openstack/stacks/_ubuntu.py index 3a16b033b..2c3c86301 100644 --- a/tobiko/openstack/stacks/_ubuntu.py +++ b/tobiko/openstack/stacks/_ubuntu.py @@ -34,8 +34,9 @@ class UbuntuMinimalImageFixture(glance.FileGlanceImageFixture): container_format = CONF.tobiko.ubuntu.container_format or "bare" username = CONF.tobiko.ubuntu.username or 'ubuntu' password = CONF.tobiko.ubuntu.password or 'ubuntu' - connection_timeout = CONF.tobiko.ubuntu.connection_timeout or 1500. + connection_timeout = CONF.tobiko.nova.ubuntu_connection_timeout disabled_algorithms = CONF.tobiko.ubuntu.disabled_algorithms + is_reachable_timeout = CONF.tobiko.nova.ubuntu_is_reachable_timeout IPERF3_SERVICE_FILE = """ @@ -199,8 +200,9 @@ class UbuntuServerStackFixture(UbuntuMinimalServerStackFixture, #: Glance image used to create a Nova server instance image_fixture = tobiko.required_fixture(UbuntuImageFixture) - # I expect Ubuntu based servers to be slow to boot - is_reachable_timeout = 900. + @property + def is_reachable_timeout(self) -> tobiko.Seconds: + return self.image_fixture.is_reachable_timeout # port of running HTTP server @property