Skip to content

Commit 1780005

Browse files
committed
Bump the Compute RPC API to version 6.0
Even if we want to bump the compute rpc api to a new major version, we still need to support 5.x for the rolling upgrade case. Adding a proxy that will handle those old RPC calls/casts so we could easily cut it in a later change in the next X release timeframe (as we won't longer support Victoria 5.x calls) On the client side, we're making sure that we can still support v5.x methods until the next X release (as operators could pin on 5.0 version for Victoria compute nodes) NOTE(sbauza): Now that the compute service only supports the 6.0 version, we could remove all the unnecessary verifications in both the manager but also the functional and unittests. That being said, given the patch would be large, I think it's better to just amend the needed modifications for supporting 6.0 and delete the above in later changes. For example, the NUMA live migration functests verify a lot of RPC API compatibities in betwen 5.2, 5.3 and later. We need to stop verifying this but let's do this in later changes, please. Change-Id: Id2e467c43d5b7c6bafd5dbbbf8d5d06be6dc7e30
1 parent 3de7fb7 commit 1780005

File tree

10 files changed

+766
-515
lines changed

10 files changed

+766
-515
lines changed

nova/compute/manager.py

Lines changed: 173 additions & 92 deletions
Large diffs are not rendered by default.

nova/compute/rpcapi.py

Lines changed: 161 additions & 156 deletions
Large diffs are not rendered by default.

nova/objects/service.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232

3333
# NOTE(danms): This is the global service version counter
34-
SERVICE_VERSION = 55
34+
SERVICE_VERSION = 56
3535

3636

3737
# NOTE(danms): This is our SERVICE_VERSION history. The idea is that any
@@ -197,6 +197,8 @@
197197
# Version 55: Compute RPC v5.13:
198198
# Add support for qos interface attach
199199
{'compute_rpc': '5.13'},
200+
# Version 56: Compute RPC v6.0:
201+
{'compute_rpc': '6.0'},
200202
)
201203

202204
# This is used to raise an error at service startup if older than N-1 computes

nova/tests/functional/integrated_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def __init__(self, version):
8686
@property
8787
def router(self):
8888
with lockutils.lock('compute-rpcapi-router'):
89-
target = messaging.Target(topic='compute', version='5.0')
89+
target = messaging.Target(topic='compute', version='6.0')
9090
version_cap = self.version
9191
serializer = objects_base.NovaObjectSerializer()
9292
rpc.get_client(target, version_cap, serializer)

nova/tests/functional/libvirt/test_numa_live_migration.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,21 @@ def _test(self, pin_source, pin_cond, expect_success=True):
479479
if pin_source:
480480
src_mgr.compute_rpcapi = integrated_helpers.StubComputeRPCAPI(
481481
'5.2')
482+
else:
483+
# Since we upgraded the RPC API to 6.0, we somehow need to pin the
484+
# compute service here to 5.max to verify the legacy behaviours.
485+
# TODO(sbauza): Remove this cruft
486+
src_mgr.compute_rpcapi = integrated_helpers.StubComputeRPCAPI(
487+
'5.13')
482488
if pin_cond:
483489
cond_mgr.compute_rpcapi = integrated_helpers.StubComputeRPCAPI(
484490
'5.2')
491+
else:
492+
# Since we upgraded the RPC API to 6.0, we somehow need to pin the
493+
# compute service here to 5.max to verify the legacy behaviours.
494+
# TODO(sbauza): Remove this cruft
495+
cond_mgr.compute_rpcapi = integrated_helpers.StubComputeRPCAPI(
496+
'5.13')
485497

486498
self.assertEqual(
487499
not pin_source,

nova/tests/functional/test_compute_mgr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@ def _test(mock_spawn, mock_grt, mock_notify, mock_cinoh, mock_can):
8080
filter_properties)
8181
self.compute.manager.build_and_run_instance(
8282
self.context, instance, {}, request_spec,
83-
filter_properties, block_device_mapping=[])
83+
filter_properties, accel_uuids=[], block_device_mapping=[])
8484
_test()
8585
self.assertIn('Preserve this', instance.fault.message)

nova/tests/unit/compute/test_compute.py

Lines changed: 135 additions & 124 deletions
Large diffs are not rendered by default.

nova/tests/unit/compute/test_compute_mgr.py

Lines changed: 34 additions & 28 deletions
Large diffs are not rendered by default.

nova/tests/unit/compute/test_rpcapi.py

Lines changed: 235 additions & 105 deletions
Large diffs are not rendered by default.

nova/tests/unit/compute/test_shelve.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ def stub_instance_save(inst, *args, **kwargs):
242242

243243
self.stub_out('nova.objects.Instance.save', stub_instance_save)
244244
self.compute.shelve_offload_instance(self.context, instance,
245-
clean_shutdown=clean_shutdown)
245+
clean_shutdown=clean_shutdown,
246+
accel_uuids=[])
246247
mock_notify.assert_has_calls([
247248
mock.call(self.context, instance, 'fake-mini',
248249
action='shelve_offload', phase='start',
@@ -509,7 +510,7 @@ def check_save(expected_task_state=None):
509510
mock_save.side_effect = check_save
510511
self.compute.unshelve_instance(self.context, instance, image=None,
511512
filter_properties=filter_properties, node=node,
512-
request_spec=objects.RequestSpec())
513+
request_spec=objects.RequestSpec(), accel_uuids=[])
513514

514515
mock_notify_instance_action.assert_has_calls([
515516
mock.call(self.context, instance, 'fake-mini',
@@ -604,7 +605,8 @@ def check_save(expected_task_state=None):
604605
self.compute.unshelve_instance,
605606
self.context, instance, image=None,
606607
filter_properties=filter_properties, node=node,
607-
request_spec=objects.RequestSpec())
608+
request_spec=objects.RequestSpec(),
609+
accel_uuids=[])
608610

609611
mock_notify_instance_action.assert_called_once_with(
610612
self.context, instance, 'fake-mini', action='unshelve',
@@ -638,7 +640,8 @@ def test_unshelve_with_resource_request(
638640

639641
self.compute.unshelve_instance(
640642
self.context, instance, image=None,
641-
filter_properties={}, node='fake-node', request_spec=request_spec)
643+
filter_properties={}, node='fake-node', request_spec=request_spec,
644+
accel_uuids=[])
642645

643646
mock_update_pci.assert_called_once_with(
644647
self.context, self.compute.reportclient, [],
@@ -667,7 +670,8 @@ def test_unshelve_with_resource_request_update_raises(
667670
self.assertRaises(
668671
exception.UnexpectedResourceProviderNameForPCIRequest,
669672
self.compute.unshelve_instance, self.context, instance, image=None,
670-
filter_properties={}, node='fake-node', request_spec=request_spec)
673+
filter_properties={}, node='fake-node', request_spec=request_spec,
674+
accel_uuids=[])
671675

672676
mock_update_pci.assert_called_once_with(
673677
self.context, self.compute.reportclient, [],
@@ -724,7 +728,7 @@ def test_shelved_poll_timedout(self):
724728

725729
data = []
726730

727-
def fake_soi(context, instance, **kwargs):
731+
def fake_soi(context, instance, accel_uuids, **kwargs):
728732
data.append(instance.uuid)
729733

730734
with mock.patch.object(self.compute, 'shelve_offload_instance') as soi:
@@ -753,7 +757,7 @@ def test_shelved_poll_filters_task_state(self, mock_parse, mock_older):
753757

754758
data = []
755759

756-
def fake_soi(context, instance, **kwargs):
760+
def fake_soi(context, instance, accel_uuids, **kwargs):
757761
data.append(instance.uuid)
758762

759763
with mock.patch.object(self.compute, 'shelve_offload_instance') as soi:

0 commit comments

Comments
 (0)