compute: Use long_rpc_timeout in reserve_block_device_name

Given the instance.uuid lock taken on the remote compute, calls to
reserve_block_device_name can take a large amount of time to complete
when attaching multiple volumes. To help avoid timeouts during such
attempts this change switches to using the long_rpc_timeout for the
overall timeout for each call.

Conflicts:
        nova/conf/rpc.py

NOTE(lyarwood): Conflicts due to the following not being present in
stable/train. I9115ef6df59844cd6e702f19ba38ffbf9f8b35d3,
I518ae675b7a67da64a5796e57e87860f0c3ef0db and
If373fedb8d2e0dfc46b8ac5b018f8216aa5c643c.

Related-Bug: #1844296
Change-Id: I17e0e45117a3312c11d6c7f2762dd416b6067979
(cherry picked from commit 648c05f7be)
This commit is contained in:
Lee Yarwood 2019-11-08 12:26:01 +00:00
parent 1552675162
commit f9a1bc7105
3 changed files with 6 additions and 1 deletions

View File

@ -1045,7 +1045,9 @@ class ComputeAPI(object):
version = '5.0'
client = self.router.client(ctxt)
cctxt = client.prepare(server=_compute_host(None, instance),
version=version)
version=version,
call_monitor_timeout=CONF.rpc_response_timeout,
timeout=CONF.long_rpc_timeout)
return cctxt.call(ctxt, 'reserve_block_device_name', **kw)
def backup_instance(self, ctxt, instance, image_id, backup_type,

View File

@ -29,6 +29,7 @@ Operations with RPC calls that utilize this value:
* live migration
* scheduling
* enabling/disabling a compute service
* volume attach
Related options:

View File

@ -510,10 +510,12 @@ class ComputeRpcAPITestCase(test.NoDBTestCase):
limits=None, request_spec=None, version='5.0')
def test_reserve_block_device_name(self):
self.flags(long_rpc_timeout=1234)
self._test_compute_api('reserve_block_device_name', 'call',
instance=self.fake_instance_obj, device='device',
volume_id='id', disk_bus='ide', device_type='cdrom',
tag='foo', multiattach=True, version='5.0',
timeout=1234, call_monitor_timeout=60,
_return_value=objects_block_dev.BlockDeviceMapping())
def test_refresh_instance_security_rules(self):