Skip to content

Commit e13c86b

Browse files
sbauzaElod Illes
authored andcommitted
add a regression test for all compute RPCAPI 6.x pinnings for rebuild
We forgot that we automatically pin our RPC calls to the RPC version that the older compute supports, so when rolling-upgrading computes, we continue to use either Yoga or Zed versions for example when upgrading to 2023.1. Since the new parameters aren't optional, we broke the rebuild_instance() method then for Yoga to Zed and Zed to 2023.1. NOTE(elod.illes): test_rebuild_instance_6_1 test needed an update, as now we are on Zed branch, so zed to zed upgrade does not raise any Error, as we have the same parameters in the RPC call. Change-Id: Icf340f3d4c5ce0a4b7388003f168e7c479e58eee Related-Bug: #2040264 (cherry picked from commit 21fd0c4) (cherry picked from commit eb310f3) (cherry picked from commit a861b57)
1 parent 53e3afe commit e13c86b

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
13+
from nova.tests import fixtures as nova_fixtures
14+
from nova.tests.functional.api import client
15+
from nova.tests.functional import integrated_helpers
16+
17+
18+
class ComputeVersion6xPinnedRpcTests(integrated_helpers._IntegratedTestBase):
19+
20+
compute_driver = 'fake.MediumFakeDriver'
21+
ADMIN_API = True
22+
api_major_version = 'v2.1'
23+
microversion = 'latest'
24+
25+
def setUp(self):
26+
super(ComputeVersion6xPinnedRpcTests, self).setUp()
27+
self.useFixture(nova_fixtures.CastAsCallFixture(self))
28+
29+
self.compute1 = self._start_compute(host='host1')
30+
31+
def _test_rebuild_instance_with_compute_rpc_pin(self, version_cap):
32+
# Since passing the latest microversion (>= 2.93) passes
33+
# the 'reimage_boot_volume' parameter as True and it is
34+
# not acceptable with compute RPC version (required 6.1)
35+
# These tests fail, so assigning microversion to 2.92
36+
self.api.microversion = '2.92'
37+
self.flags(compute=version_cap, group='upgrade_levels')
38+
39+
server_req = self._build_server(networks='none')
40+
server = self.api.post_server({'server': server_req})
41+
server = self._wait_for_state_change(server, 'ACTIVE')
42+
43+
self.api.post_server_action(server['id'], {'rebuild': {
44+
'imageRef': '155d900f-4e14-4e4c-a73d-069cbf4541e6'
45+
}})
46+
47+
# We automatically pin to 6.0 if old computes are Yoga or older.
48+
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)
56+
57+
# We automatically pin to 6.1 if old computes are Zed.
58+
def test_rebuild_instance_6_1(self):
59+
self._test_rebuild_instance_with_compute_rpc_pin('6.1')
60+
61+
# We automatically pin to 6.2 if old computes are 2023.1.
62+
def test_rebuild_instance_6_2(self):
63+
self._test_rebuild_instance_with_compute_rpc_pin('6.2')

0 commit comments

Comments
 (0)