From 1b63c7a83f4cd4e49aa0e6336dcc19d798b09f75 Mon Sep 17 00:00:00 2001 From: Lee Yarwood Date: Fri, 8 Nov 2019 12:26:01 +0000 Subject: [PATCH] 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. Related-Bug: #1844296 Change-Id: I17e0e45117a3312c11d6c7f2762dd416b6067979 --- nova/compute/rpcapi.py | 4 +++- nova/conf/rpc.py | 1 + nova/tests/unit/compute/test_rpcapi.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index 75c3b804e642..7b415e4d3ddd 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -1170,7 +1170,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, diff --git a/nova/conf/rpc.py b/nova/conf/rpc.py index 0dfc18835e9f..be39dcbc1bd7 100644 --- a/nova/conf/rpc.py +++ b/nova/conf/rpc.py @@ -32,6 +32,7 @@ Operations with RPC calls that utilize this value: * image pre-caching * snapshot-based / cross-cell resize * resize / cold migration +* volume attach Related options: diff --git a/nova/tests/unit/compute/test_rpcapi.py b/nova/tests/unit/compute/test_rpcapi.py index 90a50443b925..9ddda330835f 100644 --- a/nova/tests/unit/compute/test_rpcapi.py +++ b/nova/tests/unit/compute/test_rpcapi.py @@ -617,10 +617,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):