Fix rebuild compute RPC API exception for rolling-upgrades

By I0d889691de1af6875603a9f0f174590229e7be18 we broke rebuild for Yoga
or older computes.
By I9660d42937ad62d647afc6be965f166cc5631392 we broke rebuild for Zed
computes.

Fixing this by making the parameters optional.

Change-Id: I0ca04045f8ac742e2b50490cbe5efccaee45c5c0
Closed-Bug: #2040264
This commit is contained in:
Sylvain Bauza 2023-10-25 10:58:36 +02:00 committed by Dan Smith
parent 21fd0c430c
commit ee9ed0f7c6
2 changed files with 6 additions and 18 deletions

View File

@ -3747,7 +3747,7 @@ class ComputeManager(manager.Manager):
bdms, recreate, on_shared_storage,
preserve_ephemeral, migration,
scheduled_node, limits, request_spec, accel_uuids,
reimage_boot_volume, target_state):
reimage_boot_volume=None, target_state=None):
"""Destroy and re-make this instance.
A 'rebuild' effectively purges all existing data from the system and
@ -3781,8 +3781,9 @@ class ComputeManager(manager.Manager):
:param accel_uuids: a list of cyborg ARQ uuids
:param reimage_boot_volume: Boolean to specify whether the user has
explicitly requested to rebuild a boot
volume
:param target_state: Set a target state for the evacuated instance.
volume or None if RPC version is <=6.0
:param target_state: Set a target state for the evacuated instance or
None if RPC version is <=6.1.
"""
# recreate=True means the instance is being evacuated from a failed

View File

@ -11,7 +11,6 @@
# under the License.
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client
from nova.tests.functional import integrated_helpers
@ -46,23 +45,11 @@ class ComputeVersion6xPinnedRpcTests(integrated_helpers._IntegratedTestBase):
# We automatically pin to 6.0 if old computes are Yoga or older.
def test_rebuild_instance_6_0(self):
e = self.assertRaises(client.OpenStackApiException,
self._test_rebuild_instance_with_compute_rpc_pin, '6.0')
self.assertEqual(500, e.response.status_code)
# NOTE(sbauza): This returns a TypeError because of
# 'reimage_boot_volume' and 'target_state' parameters missing from the
# rcpapi caller.
self.assertIn('TypeError', e.response.text)
self._test_rebuild_instance_with_compute_rpc_pin('6.0')
# We automatically pin to 6.1 if old computes are Zed.
def test_rebuild_instance_6_1(self):
e = self.assertRaises(client.OpenStackApiException,
self._test_rebuild_instance_with_compute_rpc_pin, '6.1')
self.assertEqual(500, e.response.status_code)
# NOTE(sbauza): This returns a TypeError because of
# 'reimage_boot_volume' and 'target_state' parameters missing from the
# rcpapi caller.
self.assertIn('TypeError', e.response.text)
self._test_rebuild_instance_with_compute_rpc_pin('6.1')
# We automatically pin to 6.2 if old computes are 2023.1.
def test_rebuild_instance_6_2(self):