From 4a285b1fb90bd6ea00d4423f8d72116bfb4af44b Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 25 Mar 2021 08:12:34 -0700 Subject: [PATCH] Fix check_instance_shared_storage() call In the RPC 6.0 bump, we re-ordered the data and instance parameters in the client, without changing the order of the caller. This causes us to pass the instance to the virt driver call instead of the data structure, thus failing the check all the time (and barfing a traceback). This just fixes that re-ordering. Since all of our direct testing of this is done using dispatch-by-name, we didn't see a unit test fail because of it, but the error was visible in the logs of an integration run. There is one evacuate test that asserts the ordering is as we expect, which this fixes. Given the time constraints of RC1, I'm considering that to be enough coverage, but we probably need a better test that covers the seam between manager and rpcapi here. Change-Id: Ie7e06776315e5e82e7d320919f1781fa2164398a Closes-Bug: #1921399 --- nova/compute/manager.py | 2 +- nova/tests/unit/compute/test_compute.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index f0614962f342..8e7b8885590e 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -794,7 +794,7 @@ class ComputeManager(manager.Manager): if data: shared_storage = (self.compute_rpcapi. check_instance_shared_storage(context, - instance, data, host=host)) + data, instance=instance, host=host)) except NotImplementedError: LOG.debug('Hypervisor driver does not support ' 'instance shared storage check, ' diff --git a/nova/tests/unit/compute/test_compute.py b/nova/tests/unit/compute/test_compute.py index 02bcbd8f3109..67d459b64507 100644 --- a/nova/tests/unit/compute/test_compute.py +++ b/nova/tests/unit/compute/test_compute.py @@ -7654,8 +7654,9 @@ class ComputeTestCase(BaseTestCase, mock_get_blk.assert_called_once_with(fake_context, evacuated_instance) mock_check_local.assert_called_once_with(fake_context, evacuated_instance) - mock_check.assert_called_once_with(fake_context, evacuated_instance, + mock_check.assert_called_once_with(fake_context, {'filename': 'tmpfilename'}, + instance=evacuated_instance, host=None) mock_check_clean.assert_called_once_with(fake_context, {'filename': 'tmpfilename'})