Clear OVO history and compatibility

The Oslo Versioned Objects history is used to generate the manifests
required to do compatibility changes to OVOs on data serialization
between services running with different OVO history versions.

We haven't updated our OVO history since Train so all the history and
compatibility code (obj_make_compatible method) is no longer necessary.

This patch consolidates the OVO history into a single version reflecting
the current status of the OVO versions and removes the compatibility
code from the OVO classes.

Since we tend to forget to update the obj_make_compatible when we add a
field (like it happened with Volume in version 1.8 when we added
shared_targets) this patch also adds a note next to the "fields"
attribute (except for the list OVOs which are never updated).

Change-Id: Ibfacccfb7c7dc70bc8f8e5ab98cc9c8feae694fb
This commit is contained in:
Gorka Eguileor
2021-04-08 19:16:15 +02:00
parent 28d9bca7d6
commit b78997c2bb
33 changed files with 147 additions and 377 deletions

View File

@@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_utils import versionutils
from oslo_versionedobjects import fields
from cinder import objects
@@ -30,6 +29,7 @@ class RequestSpec(base.CinderObject, base.CinderObjectDictCompat,
# Version 1.5: Added 'availability_zones'
VERSION = '1.5'
# NOTE: When adding a field obj_make_compatible needs to be updated
fields = {
'consistencygroup_id': fields.UUIDField(nullable=True),
'group_id': fields.UUIDField(nullable=True),
@@ -95,20 +95,6 @@ class RequestSpec(base.CinderObject, base.CinderObjectDictCompat,
return spec_obj
def obj_make_compatible(self, primitive, target_version):
"""Make an object representation compatible with target version."""
super(RequestSpec, self).obj_make_compatible(primitive, target_version)
target_version = versionutils.convert_version_to_tuple(target_version)
added_fields = (((1, 1), ('group_id', 'group_backend')),
((1, 2), ('resource_backend')),
((1, 3), ('backup_id')),
((1, 4), ('operation')),
((1, 5), ('availability_zones')))
for version, remove_fields in added_fields:
if target_version < version:
for obj_field in remove_fields:
primitive.pop(obj_field, None)
@base.CinderObjectRegistry.register
class VolumeProperties(base.CinderObject, base.CinderObjectDictCompat):