Browse Source

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 d3ca735686)
(cherry picked from commit e61d002530)
changes/32/725932/3
Dan Smith 2 months ago
committed by Stephen Finucane
parent
commit
38ee1f3942
2 changed files with 0 additions and 22 deletions
  1. +0
    -8
      nova/objects/instance_pci_requests.py
  2. +0
    -14
      nova/tests/unit/objects/test_instance_pci_requests.py

+ 0
- 8
nova/objects/instance_pci_requests.py View File

@@ -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=[],


+ 0
- 14
nova/tests/unit/objects/test_instance_pci_requests.py View File

@@ -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)


Loading…
Cancel
Save