From b46f3c2d8c51e91a89a2b29e817800460ef17d51 Mon Sep 17 00:00:00 2001 From: Rei Oliveira Date: Wed, 12 Jun 2024 18:28:31 -0300 Subject: [PATCH] Add support for connect and read timeouts The current keystone auth library only allows the configuration of 1 timeout value, that gets used for both connection_timeout and read_timeout in the lower layers of the python requests library. This change enables the usage of both connection and read timeout when creating keystone session. This change is localized to session.py because it's already supported by the python requests library. It will enable for fail fast when the endpoint is offline when used with shorter values for connect timeout while keeping a longer read_timeout. For instance: (5, 30), where (connection_timeout, read_timeout) This change is to support task 50365 in [1]. [1] https://storyboard.openstack.org/#!/story/2011106 Test plan: PASS: Run a full build, install, bootstrap and unlock. PASS: Check alarms with 'fm alarm-list' Story: 2011106 Task: 50363 Change-Id: Iab5c784adfecdc6c9decba6ca72258536fb2122f Signed-off-by: Rei Oliveira --- debian_iso_image.inc | 2 ++ debian_pkg_dirs | 1 + .../deb_patches/0001-Remove-oslotest.patch | 28 +++++++++++++++++ .../debian/deb_patches/series | 1 + .../debian/meta_data.yaml | 12 ++++++++ ...upport-for-connect-and-read-timeouts.patch | 30 +++++++++++++++++++ .../debian/patches/series | 1 + 7 files changed, 75 insertions(+) create mode 100644 openstack/python-keystoneauth1/debian/deb_patches/0001-Remove-oslotest.patch create mode 100644 openstack/python-keystoneauth1/debian/deb_patches/series create mode 100644 openstack/python-keystoneauth1/debian/meta_data.yaml create mode 100644 openstack/python-keystoneauth1/debian/patches/0001-Add-support-for-connect-and-read-timeouts.patch create mode 100644 openstack/python-keystoneauth1/debian/patches/series diff --git a/debian_iso_image.inc b/debian_iso_image.inc index 66cb3cee..7cc51f8b 100644 --- a/debian_iso_image.inc +++ b/debian_iso_image.inc @@ -26,6 +26,8 @@ python3-django-horizon python-keystoneclient-doc python3-keystoneclient +python3-keystoneauth1 + #python-openstackclient python-openstackclient-doc python3-openstackclient diff --git a/debian_pkg_dirs b/debian_pkg_dirs index 388da021..c57a8385 100644 --- a/debian_pkg_dirs +++ b/debian_pkg_dirs @@ -5,6 +5,7 @@ openstack/openstack-ras openstack/python-barbicanclient openstack/python-horizon openstack/python-keystoneclient +openstack/python-keystoneauth1 openstack/python-openstackclient openstack/python-osc-lib openstack/python-oslo-messaging diff --git a/openstack/python-keystoneauth1/debian/deb_patches/0001-Remove-oslotest.patch b/openstack/python-keystoneauth1/debian/deb_patches/0001-Remove-oslotest.patch new file mode 100644 index 00000000..bcb5551a --- /dev/null +++ b/openstack/python-keystoneauth1/debian/deb_patches/0001-Remove-oslotest.patch @@ -0,0 +1,28 @@ +From cc031eea3f4a7a4633a34c8db0aa7762e00195a3 Mon Sep 17 00:00:00 2001 +From: Rei Oliveira +Date: Fri, 14 Jun 2024 20:29:10 -0300 +Subject: [PATCH] Remove oslotest. + +This dependency is only used for testing and is not required for the +debian build or during runtime. +The reason for removal is that it's causing build dependency issues. + +Signed-off-by: Rei Oliveira +--- + debian/control | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/debian/control b/debian/control +index 6e9b6b3..c445255 100644 +--- a/debian/control ++++ b/debian/control +@@ -25,7 +25,6 @@ Build-Depends-Indep: + python3-os-service-types, + python3-oslo.config, + python3-oslo.utils, +- python3-oslotest, + python3-pep8, + python3-requests, + python3-requests-kerberos, +-- +2.34.1 \ No newline at end of file diff --git a/openstack/python-keystoneauth1/debian/deb_patches/series b/openstack/python-keystoneauth1/debian/deb_patches/series new file mode 100644 index 00000000..474a92cc --- /dev/null +++ b/openstack/python-keystoneauth1/debian/deb_patches/series @@ -0,0 +1 @@ +0001-Remove-oslotest.patch diff --git a/openstack/python-keystoneauth1/debian/meta_data.yaml b/openstack/python-keystoneauth1/debian/meta_data.yaml new file mode 100644 index 00000000..945117e6 --- /dev/null +++ b/openstack/python-keystoneauth1/debian/meta_data.yaml @@ -0,0 +1,12 @@ +--- +debname: python-keystoneauth1 +debver: 4.2.1-2 +dl_path: + name: python-keystoneauth1-debian-4.2.1-2.tar.gz + url: https://salsa.debian.org/openstack-team/libs/python-keystoneauth1/-/archive/debian/4.2.1-2/python-keystoneauth1-debian-4.2.1-2.tar.gz + sha256sum: edb9c128d5f76883caaec7c6d1783199cba6b3bb207af6c80b962596abb5e8d1 +revision: + dist: $STX_DIST + GITREVCOUNT: + BASE_SRCREV: 000011c85e18aa366805332be0625f22d3f8374a + SRC_DIR: ${MY_REPO}/stx/upstream/openstack/python-keystoneauth1 diff --git a/openstack/python-keystoneauth1/debian/patches/0001-Add-support-for-connect-and-read-timeouts.patch b/openstack/python-keystoneauth1/debian/patches/0001-Add-support-for-connect-and-read-timeouts.patch new file mode 100644 index 00000000..71d1d6b8 --- /dev/null +++ b/openstack/python-keystoneauth1/debian/patches/0001-Add-support-for-connect-and-read-timeouts.patch @@ -0,0 +1,30 @@ +From f9a992832e96e772cef7605b8879cd1569444cf0 Mon Sep 17 00:00:00 2001 +From: Rei Oliveira +Date: Mon, 17 Jun 2024 16:57:46 -0300 +Subject: [PATCH] Allow the setting of connection timeout and read timeouts + +Allow the setting of connection timeout and read timeouts + +Signed-off-by: Rei Oliveira +--- + keystoneauth1/session.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/keystoneauth1/session.py b/keystoneauth1/session.py +index f4c400c..d7240ce 100644 +--- a/keystoneauth1/session.py ++++ b/keystoneauth1/session.py +@@ -380,7 +380,10 @@ class Session(object): + self._rate_semaphore = rate_semaphore or NoOpSemaphore() + + if timeout is not None: +- self.timeout = float(timeout) ++ if isinstance(timeout, tuple): ++ self.timeout = (float(timeout[0]), float(timeout[1])) ++ else: ++ self.timeout = float(timeout) + + if user_agent is not None: + self.user_agent = "%s %s" % (user_agent, DEFAULT_USER_AGENT) +-- +2.34.1 diff --git a/openstack/python-keystoneauth1/debian/patches/series b/openstack/python-keystoneauth1/debian/patches/series new file mode 100644 index 00000000..c2769444 --- /dev/null +++ b/openstack/python-keystoneauth1/debian/patches/series @@ -0,0 +1 @@ +0001-Add-support-for-connect-and-read-timeouts.patch