Remove OVO unneeded compatibility conversions
OVOs and commit introducing the removed conversion: - PortDNS: * https://review.opendev.org/#/c/457035/: included in Pike - Port: * https://review.opendev.org/#/c/465423/: included in Pike - Trunk: * https://review.opendev.org/#/c/382659/: included in Ocata - QosRuleType: * https://review.opendev.org/#/c/475260/: included in Pike Change-Id: I9353fa1b660212f244abf74921ebc90f0a2333b7 Related-Bug: #1828437
This commit is contained in:
parent
1a3811448d
commit
dc655cabcb
@ -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:
|
||||
|
@ -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):
|
||||
|
@ -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')
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
@ -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(
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user