Merge "Remove OVO unneeded compatibility conversions"

This commit is contained in:
Zuul 2020-06-21 06:46:38 +00:00 committed by Gerrit Code Review
commit 3f0a9a2514
7 changed files with 0 additions and 51 deletions

View File

@ -248,11 +248,6 @@ class PortDNS(base.NeutronDbObject):
'dns_domain': common_types.DomainNameField(),
}
def obj_make_compatible(self, primitive, target_version):
_target_version = versionutils.convert_version_to_tuple(target_version)
if _target_version < (1, 1):
primitive.pop('dns_domain', None)
@base.NeutronObjectRegistry.register
class SecurityGroupPortBinding(base.NeutronDbObject):
@ -500,8 +495,6 @@ class Port(base.NeutronDbObject):
def obj_make_compatible(self, primitive, target_version):
_target_version = versionutils.convert_version_to_tuple(target_version)
if _target_version < (1, 1):
primitive.pop('data_plane_status', None)
if _target_version < (1, 2):
binding_levels = primitive.get('binding_levels', [])
for lvl in binding_levels:

View File

@ -14,8 +14,6 @@ from neutron_lib.objects import common_types
from neutron_lib.plugins import constants
from neutron_lib.plugins import directory
from neutron_lib.services.qos import constants as qos_consts
from oslo_utils import versionutils
from oslo_versionedobjects import exception
from oslo_versionedobjects import fields as obj_fields
from neutron.objects import base
@ -74,12 +72,6 @@ class QosRuleType(base.NeutronObject):
def get_values(cls, field, **kwargs):
return [getattr(obj, field) for obj in cls.get_objects(**kwargs)]
def obj_make_compatible(self, primitive, target_version):
_target_version = versionutils.convert_version_to_tuple(target_version)
if _target_version < (1, 3):
raise exception.IncompatibleObjectVersion(
objver=target_version, objtype=self.__class__.__name__)
@base.NeutronObjectRegistry.register
class QosRuleTypeDriver(base.NeutronObject):

View File

@ -17,7 +17,6 @@ from neutron_lib import exceptions as n_exc
from neutron_lib.objects import common_types
from neutron_lib.objects import exceptions as o_exc
from oslo_db import exception as o_db_exc
from oslo_utils import versionutils
from oslo_versionedobjects import fields as obj_fields
from neutron.objects import base
@ -138,9 +137,3 @@ class Trunk(base.NeutronDbObject):
# or self.db_obj.standard_attr
pass
return _dict
def obj_make_compatible(self, primitive, target_version):
_target_version = versionutils.convert_version_to_tuple(target_version)
if _target_version < (1, 1):
primitive['tenant_id'] = primitive.pop('project_id')

View File

@ -19,7 +19,6 @@ from neutron_lib import constants as lib_consts
from neutron_lib.db import constants as db_consts
from neutron_lib.services.qos import constants as qos_consts
from oslo_config import cfg
from oslo_versionedobjects import exception
from neutron import manager
from neutron.objects.qos import rule_type
@ -88,8 +87,3 @@ class QosRuleTypeObjectTestCase(test_base.BaseTestCase):
def test_wrong_type(self):
self.assertRaises(ValueError, rule_type.QosRuleType, type='bad_type')
def test_object_version_degradation_less_than_1_3(self):
qos_rule_type = rule_type.QosRuleType()
self.assertRaises(exception.IncompatibleObjectVersion,
qos_rule_type.obj_to_primitive, '1.2')

View File

@ -33,7 +33,6 @@ from oslo_db import exception as obj_exc
from oslo_db.sqlalchemy import utils as db_utils
from oslo_utils import uuidutils
from oslo_versionedobjects import base as obj_base
from oslo_versionedobjects import exception
from oslo_versionedobjects import fields as obj_fields
from sqlalchemy import orm
import testtools
@ -1699,14 +1698,6 @@ class BaseDbObjectTestCase(_BaseObjectTestCase,
**remove_timestamps_from_fields(
fields, self._test_class.fields))
def test_downgrade_to_1_0(self):
for obj in self.objs:
try:
obj.obj_to_primitive(target_version='1.0')
except exception.IncompatibleObjectVersion:
# the only exception we should allow is IncompatibleVersion
pass
def test_get_object_create_update_delete(self):
# Timestamps can't be initialized and multiple objects may use standard
# attributes so we need to remove timestamps when creating objects

View File

@ -379,12 +379,6 @@ class PortDbObjectTestCase(obj_test_base.BaseDbObjectTestCase,
self.skipTest(
'Port object loads segment info without relationships')
def test_v1_1_to_v1_0_drops_data_plane_status(self):
port_new = self._create_test_port()
port_v1_0 = port_new.obj_to_primitive(target_version='1.0')
self.assertNotIn('data_plane_status',
port_v1_0['versioned_object.data'])
def test_v1_2_to_v1_1_drops_segment_id_in_binding_levels(self):
port_new = self._create_test_port()
segment = network.NetworkSegment(

View File

@ -172,14 +172,6 @@ class TrunkDbObjectTestCase(test_base.BaseDbObjectTestCase,
if k in kwargs:
self.assertEqual(kwargs[k], trunk[k])
def test_v1_1_to_v1_0_drops_project_id(self):
trunk_new = self._test_create_trunk_with_subports(
self.db_objs[0]['port_id'], [1, 2])
trunk_v1_0 = trunk_new.obj_to_primitive(target_version='1.0')
self.assertNotIn('project_id', trunk_v1_0['versioned_object.data'])
self.assertIn('tenant_id', trunk_v1_0['versioned_object.data'])
def test_get_objects_tenant_id(self):
trunk = t_obj.Trunk(context=self.context,
project_id='faketenant',