RBD: Use rados_connect_timeout to override timeout
This imports the existing rados_connect_timeout option handling in
cinder so that users can use a different timeouts for Glance
specifically, instead of relying on the global ceph.conf options.
This parameter was initially deprecated in Zed release by [1] and has
had no effect since then, but this change restores the parameter with
the logic to override the timeout value in RADOS client.
[1] b1d0feeba4
Related-Bug: #1983499
Change-Id: Ib370f527c06dc85bcfd9df6ca1efb2a4e8cb5e7d
This commit is contained in:
parent
0c60291637
commit
c197bbdcca
@ -134,14 +134,7 @@ Related options:
|
||||
* 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.
|
||||
|
||||
@ -149,8 +142,8 @@ 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
|
||||
@ -302,6 +295,18 @@ class Store(driver.Store):
|
||||
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:
|
||||
|
@ -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.
|
Loading…
Reference in New Issue
Block a user