diff --git a/glance_store/_drivers/rbd.py b/glance_store/_drivers/rbd.py index ba2defa3..5e18af8f 100644 --- a/glance_store/_drivers/rbd.py +++ b/glance_store/_drivers/rbd.py @@ -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: diff --git a/releasenotes/notes/fix-rados_connect_timeout-39e5074bc1a3b65b.yaml b/releasenotes/notes/fix-rados_connect_timeout-39e5074bc1a3b65b.yaml new file mode 100644 index 00000000..27aef5be --- /dev/null +++ b/releasenotes/notes/fix-rados_connect_timeout-39e5074bc1a3b65b.yaml @@ -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.