From e61d0025303b33ef00aa95ebd934f6121d320cbb Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 21 Apr 2020 09:07:32 -0700 Subject: [PATCH] Remove stale nested backport from InstancePCIRequests Sometime in 2015, we removed the hard-coded obj_relationships mapping from parent objects which facilitated semi-automated child version backports. This was replaced by a manifest-of-versions mechanism where the client reports all the supported objects and versions during a backport request to conductor. The InstancePCIRequests object isn't technically an ObjectListBase, despite acting like one, and thus wasn't using the obj_relationships. Because of this, it was doing its own backporting of its child object, which was not removed in the culling of the static mechanism. Because we now no longer need to worry about sub-object backport chaining, when version 1.2 was added, no backport rule was added, and since the object does not call the base class' generic routine, proper backporting of the child object was not happening. All we need to do is remove the override to allow the base infrastructure to do the work. Change-Id: Id610a24c066707de5ddc0507e7ef26c421ba366c Closes-Bug: #1868033 (cherry picked from commit d3ca7356860d64555eef6f5138501cb38f50ecc8) --- nova/objects/instance_pci_requests.py | 8 -------- .../unit/objects/test_instance_pci_requests.py | 14 -------------- 2 files changed, 22 deletions(-) diff --git a/nova/objects/instance_pci_requests.py b/nova/objects/instance_pci_requests.py index 3a7477f8e3c7..7d35af794aeb 100644 --- a/nova/objects/instance_pci_requests.py +++ b/nova/objects/instance_pci_requests.py @@ -82,14 +82,6 @@ class InstancePCIRequests(base.NovaObject, 'requests': fields.ListOfObjectsField('InstancePCIRequest'), } - def obj_make_compatible(self, primitive, target_version): - target_version = versionutils.convert_version_to_tuple(target_version) - if target_version < (1, 1) and 'requests' in primitive: - for index, request in enumerate(self.requests): - request.obj_make_compatible( - primitive['requests'][index]['nova_object.data'], '1.0') - primitive['requests'][index]['nova_object.version'] = '1.0' - @classmethod def obj_from_db(cls, context, instance_uuid, db_requests): self = cls(context=context, requests=[], diff --git a/nova/tests/unit/objects/test_instance_pci_requests.py b/nova/tests/unit/objects/test_instance_pci_requests.py index 2ccd7397b0ce..f3b324cdb1f6 100644 --- a/nova/tests/unit/objects/test_instance_pci_requests.py +++ b/nova/tests/unit/objects/test_instance_pci_requests.py @@ -99,20 +99,6 @@ class _TestInstancePCIRequests(object): self.assertEqual('alias_2', requests.requests[1].alias_name) self.assertTrue(requests.requests[1].is_new) - def test_backport_1_0(self): - requests = objects.InstancePCIRequests( - requests=[objects.InstancePCIRequest(count=1, - request_id=FAKE_UUID), - objects.InstancePCIRequest(count=2, - request_id=FAKE_UUID)]) - primitive = requests.obj_to_primitive(target_version='1.0') - backported = objects.InstancePCIRequests.obj_from_primitive( - primitive) - self.assertEqual('1.0', backported.VERSION) - self.assertEqual(2, len(backported.requests)) - self.assertFalse(backported.requests[0].obj_attr_is_set('request_id')) - self.assertFalse(backported.requests[1].obj_attr_is_set('request_id')) - def test_obj_from_db(self): req = objects.InstancePCIRequests.obj_from_db(None, FAKE_UUID, None) self.assertEqual(FAKE_UUID, req.instance_uuid)