Skip to content

Commit

Permalink
Merge "RBD: Use rados_connect_timeout to override timeout"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Jan 19, 2024
2 parents 398bc02 + c197bbd commit e823a3c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
25 changes: 15 additions & 10 deletions glance_store/_drivers/rbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,16 @@
* rbd_store_user
"""),
cfg.IntOpt('rados_connect_timeout', default=0,
deprecated_for_removal=True,
deprecated_since='Zed',
deprecated_reason="""
This option has not had any effect in years. Users willing to set a timeout for
connecting to the Ceph cluster should use 'client_mount_timeout' in Ceph's
configuration file.
""",
cfg.IntOpt('rados_connect_timeout', default=-1,
help="""
Timeout value for connecting to Ceph cluster.
This configuration option takes in the timeout value in seconds used
when connecting to the Ceph cluster i.e. it sets the time to wait for
glance-api before closing the connection. This prevents glance-api
hangups during the connection to RBD. If the value for this option
is set to less than or equal to 0, no timeout is set and the default
librados value is used.
is set to less than 0, no timeout is set and the default librados value
is used.
Possible Values:
* Any integer value
Expand Down Expand Up @@ -302,6 +295,18 @@ def RBDProxy(self):
def get_connection(self, conffile, rados_id):
client = rados.Rados(conffile=conffile, rados_id=rados_id)

if self.backend_group:
timeout = getattr(self.conf,
self.backend_group).rados_connect_timeout
else:
timeout = self.conf.glance_store.rados_connect_timeout

if timeout >= 0:
t = str(timeout)
client.conf_set('rados_osd_op_timeout', t)
client.conf_set('rados_mon_op_timeout', t)
client.conf_set('client_mount_timeout', t)

try:
client.connect()
except (rados.Error, rados.ObjectNotFound) as e:
Expand Down
19 changes: 19 additions & 0 deletions releasenotes/notes/fix-rados_connect_timeout-39e5074bc1a3b65b.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
features:
- |
RBD driver: the ``rados_connect_timeout`` config option has been
un-deprecated and its behavior has been improved. A value of ``0``
is now respected as disabling timeout in requests, while a value less
than zero indicates that glance_store will not set a timeout but
instead will use whatever timeouts are set in the Ceph configuration
file.
upgrade:
- |
RBD driver: the default value of the ``rados_connect_timeout`` option
has been changed from 0 to -1, so that the RBD driver will by default
use the timeout values defined in ``ceph.conf``. Be aware that
setting this option to 0 disables timeouts (that is, the RBD driver
will make requests with a timeout of zero, and all requests wait forever),
thereby overriding any timeouts that are set in the Ceph configuration
file.

0 comments on commit e823a3c

Please sign in to comment.