Version change in ObjectField does not work with back-levelling

Bug #1275675 reported by Paul Murray
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Won't Fix
Wishlist
Unassigned
oslo.versionedobjects
Expired
Wishlist
Unassigned

Bug Description

When a NovaObject primitive is deserialized the object version is checked and an IncompatibleObjectVersion exception is raised if the serialized primitive is labelled with a version that is not known locally. The exception indicates what version is known locally, and the deserialization attempts to backport the primitive to the local version.

If a NovaObject A has an ObjectField b containing NovaObject B and it is B that has the incompatible version, the version number in the exception will be the the locally supported version for B. The desrialization will then attempt to backport the primitive of object A to the locally supported version number for object B.

Revision history for this message
Paul Murray (pmurray) wrote :

The following test demonstrates the bug:

given these class versions:

class Container(base.NovaObject):
    VERSION = '5.5'
    fields = {
        'nested': fields.ObjectField('MyObj'),
    }

class MyObj(base.NovaPersistentObject, base.NovaObject):
    VERSION = '1.5'
<...rest of object code cut out...>

The following test passes:

    def test_deserialize_nested_object(self):
        ser = base.NovaObjectSerializer()
        ser._conductor = mock.Mock()
        ser._conductor.object_backport.return_value = 'backported'
        A = Container()
        B = MyObj()
        A.nested = B
        B.VERSION = '1.25'
        primitive = A.obj_to_primitive()
        result = ser.deserialize_entity(self.context, primitive)
        self.assertEqual('backported', result)
        ser._conductor.object_backport.assert_called_with(self.context,
                                                          primitive,
                                                          '1.5')

So _conductor.object_backport is being called with the primitive of A and the version number of B.

Paul Murray (pmurray)
description: updated
Revision history for this message
Matt Riedemann (mriedem) wrote :
tags: added: unified-objects
Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → Wishlist
Paul Murray (pmurray)
Changed in nova:
assignee: nobody → Paul Murray (pmurray)
Revision history for this message
Paul Murray (pmurray) wrote :

As suggested here: http://lists.openstack.org/pipermail/openstack-dev/2014-February/026151.html the deserializer could indicate to conductor which object is the problem and allow it to attempt a conversion on that object. That could be a useful thing to do, but is not part of the original design and out of scope right now. In particular the object code currently assumes that the object versions line up correctly when nesting objects.

This bug should not surface if code is written and tested correctly, but its easy to check for so I'll propose the following fix to close it.

1. Add new exception NestedObjectVersionError for this error condition.
2. When the deserializer receives the IncompatibleObjectVersionError exception it checks to see it refers to the top level prim object itself. If it doesn't the exception comes from an incorrect nested object, so raise a new exception inidicating this condition.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/78605

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Paul Murray (<email address hidden>) on branch: master
Review: https://review.openstack.org/78605
Reason: Actually, I'll just abandon it.

Changed in nova:
status: In Progress → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/202554

Changed in nova:
assignee: Paul Murray (pmurray) → Nikola Đipanov (ndipanov)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/202560

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Nikola Dipanov (<email address hidden>) on branch: master
Review: https://review.openstack.org/202554
Reason: Will abandon for a more optimal fix that does not potentially send more than one backleveling request for a highly nested structure

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (stable/kilo)

Change abandoned by Nikola Dipanov (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/202560

Changed in nova:
assignee: Nikola Đipanov (ndipanov) → nobody
status: In Progress → Confirmed
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

This is now over 2 years old and the comments in [1] indicate that this is the responsibility of "oslo.versionedobjects" now. The ML discussion [1] doesn't show a clear path forward neither. I'm closing it as "won't fix".

References:
[1] https://review.openstack.org/#/c/202554/
[2] http://lists.openstack.org/pipermail/openstack-dev/2014-February/026151.html

Changed in nova:
status: Confirmed → Won't Fix
Revision history for this message
Ben Nemec (bnemec) wrote :

Setting to wishlist, per the original nova bug. However, as the bug is years old, can we verify that it is still present in current versions of o.vo?

Changed in oslo.versionedobjects:
importance: Undecided → Wishlist
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for oslo.versionedobjects because there has been no activity for 60 days.]

Changed in oslo.versionedobjects:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.