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 <Reinildes.JoseMateusOliveira@windriver.com>
This commit is contained in:
Rei Oliveira 2024-06-12 18:28:31 -03:00
parent 000011c85e
commit b46f3c2d8c
7 changed files with 75 additions and 0 deletions

View File

@ -26,6 +26,8 @@ python3-django-horizon
python-keystoneclient-doc python-keystoneclient-doc
python3-keystoneclient python3-keystoneclient
python3-keystoneauth1
#python-openstackclient #python-openstackclient
python-openstackclient-doc python-openstackclient-doc
python3-openstackclient python3-openstackclient

View File

@ -5,6 +5,7 @@ openstack/openstack-ras
openstack/python-barbicanclient openstack/python-barbicanclient
openstack/python-horizon openstack/python-horizon
openstack/python-keystoneclient openstack/python-keystoneclient
openstack/python-keystoneauth1
openstack/python-openstackclient openstack/python-openstackclient
openstack/python-osc-lib openstack/python-osc-lib
openstack/python-oslo-messaging openstack/python-oslo-messaging

View File

@ -0,0 +1,28 @@
From cc031eea3f4a7a4633a34c8db0aa7762e00195a3 Mon Sep 17 00:00:00 2001
From: Rei Oliveira <Reinildes.JoseMateusOliveira@windriver.com>
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 <Reinildes.JoseMateusOliveira@windriver.com>
---
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

View File

@ -0,0 +1 @@
0001-Remove-oslotest.patch

View File

@ -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

View File

@ -0,0 +1,30 @@
From f9a992832e96e772cef7605b8879cd1569444cf0 Mon Sep 17 00:00:00 2001
From: Rei Oliveira <Reinildes.JoseMateusOliveira@windriver.com>
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 <Reinildes.JoseMateusOliveira@windriver.com>
---
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

View File

@ -0,0 +1 @@
0001-Add-support-for-connect-and-read-timeouts.patch