Skip to content

Commit ee9ed0f

Browse files
sbauzakk7ds
authored andcommitted
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
1 parent 21fd0c4 commit ee9ed0f

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

nova/compute/manager.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3747,7 +3747,7 @@ def rebuild_instance(self, context, instance, orig_image_ref, image_ref,
37473747
bdms, recreate, on_shared_storage,
37483748
preserve_ephemeral, migration,
37493749
scheduled_node, limits, request_spec, accel_uuids,
3750-
reimage_boot_volume, target_state):
3750+
reimage_boot_volume=None, target_state=None):
37513751
"""Destroy and re-make this instance.
37523752

37533753
A 'rebuild' effectively purges all existing data from the system and
@@ -3781,8 +3781,9 @@ def rebuild_instance(self, context, instance, orig_image_ref, image_ref,
37813781
:param accel_uuids: a list of cyborg ARQ uuids
37823782
:param reimage_boot_volume: Boolean to specify whether the user has
37833783
explicitly requested to rebuild a boot
3784-
volume
3785-
:param target_state: Set a target state for the evacuated instance.
3784+
volume or None if RPC version is <=6.0
3785+
:param target_state: Set a target state for the evacuated instance or
3786+
None if RPC version is <=6.1.
37863787

37873788
"""
37883789
# recreate=True means the instance is being evacuated from a failed

nova/tests/functional/regressions/test_bug_2040264.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# under the License.
1212

1313
from nova.tests import fixtures as nova_fixtures
14-
from nova.tests.functional.api import client
1514
from nova.tests.functional import integrated_helpers
1615

1716

@@ -46,23 +45,11 @@ def _test_rebuild_instance_with_compute_rpc_pin(self, version_cap):
4645

4746
# We automatically pin to 6.0 if old computes are Yoga or older.
4847
def test_rebuild_instance_6_0(self):
49-
e = self.assertRaises(client.OpenStackApiException,
50-
self._test_rebuild_instance_with_compute_rpc_pin, '6.0')
51-
self.assertEqual(500, e.response.status_code)
52-
# NOTE(sbauza): This returns a TypeError because of
53-
# 'reimage_boot_volume' and 'target_state' parameters missing from the
54-
# rcpapi caller.
55-
self.assertIn('TypeError', e.response.text)
48+
self._test_rebuild_instance_with_compute_rpc_pin('6.0')
5649

5750
# We automatically pin to 6.1 if old computes are Zed.
5851
def test_rebuild_instance_6_1(self):
59-
e = self.assertRaises(client.OpenStackApiException,
60-
self._test_rebuild_instance_with_compute_rpc_pin, '6.1')
61-
self.assertEqual(500, e.response.status_code)
62-
# NOTE(sbauza): This returns a TypeError because of
63-
# 'reimage_boot_volume' and 'target_state' parameters missing from the
64-
# rcpapi caller.
65-
self.assertIn('TypeError', e.response.text)
52+
self._test_rebuild_instance_with_compute_rpc_pin('6.1')
6653

6754
# We automatically pin to 6.2 if old computes are 2023.1.
6855
def test_rebuild_instance_6_2(self):

0 commit comments

Comments
 (0)