Fix the compute RPC 5.12 issue

In I147bf4d95e6d86ff1f967a8ce37260730f21d236 we added a new argument for
the rebuild_instance() RPC method. Unfortunately, we missed to that it
needs to be optional for older versions.

Adding a default none value for it so rolling upgrades would work.

Change-Id: I59c5e56b00114fea5ec19fa63ec73f032dc3bd5c
Closes-Bug: #1902925
(cherry picked from commit 8d9f298f4c)
This commit is contained in:
Sylvain Bauza 2020-11-04 20:20:52 +01:00
parent 239ffff2ab
commit a06e27592f
3 changed files with 16 additions and 11 deletions

View File

@ -3325,7 +3325,8 @@ class ComputeManager(manager.Manager):
injected_files, new_pass, orig_sys_metadata,
bdms, recreate, on_shared_storage,
preserve_ephemeral, migration,
scheduled_node, limits, request_spec, accel_uuids):
scheduled_node, limits, request_spec,
accel_uuids=None):
"""Destroy and re-make this instance.
A 'rebuild' effectively purges all existing data from the system and
@ -3356,7 +3357,8 @@ class ComputeManager(manager.Manager):
:param limits: Overcommit limits set by the scheduler. If a host was
specified by the user, this will be None
:param request_spec: a RequestSpec object used to schedule the instance
:param accel_uuids: a list of cyborg ARQ uuids.
:param accel_uuids: a list of cyborg ARQ uuids or None if the RPC API
is <=5.11
"""
# recreate=True means the instance is being evacuated from a failed

View File

@ -9,7 +9,6 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from nova.tests.functional.api import client
from nova.tests.functional import integrated_helpers
from nova.tests.unit import cast_as_call
@ -39,14 +38,7 @@ class ComputeVersion5xPinnedRpcTests(integrated_helpers._IntegratedTestBase):
}})
def test_rebuild_instance_5_0(self):
e = self.assertRaises(client.OpenStackApiException,
self._test_rebuild_instance_with_compute_rpc_pin, '5.0')
self.assertEqual(500, e.response.status_code)
# NOTE(sbauza): It provides a TypeError because of 'accel_uuids'
# parameter missing
# TypeError: rebuild_instance() missing 1 required positional argument:
# 'accel_uuids'
self.assertIn('TypeError', e.response.text)
self._test_rebuild_instance_with_compute_rpc_pin('5.0')
def test_rebuild_instance_5_12(self):
self._test_rebuild_instance_with_compute_rpc_pin('5.12')

View File

@ -0,0 +1,11 @@
---
fixes:
- |
When upgrading compute services from Ussuri to Victoria each by one, the
Compute RPC API was pinning to 5.11 (either automatically or by using
the specific rpc version in the option) but when rebuilding an instance,
a TypeError was raised as an argument was not provided. This error is
fixed by `bug 1902925`_.
.. _bug 1902925: https://bugs.launchpad.net/nova/+bug/1902925/