Merge "objects: update fields_no_update to reflect models"

This commit is contained in:
Jenkins 2017-05-27 00:20:37 +00:00 committed by Gerrit Code Review
commit 3946838ab3
9 changed files with 19 additions and 3 deletions

View File

@ -35,3 +35,5 @@ class AutoAllocatedTopology(base.NeutronDbObject):
'network_id': common_types.UUIDField(),
'router_id': common_types.UUIDField(nullable=True),
}
fields_no_update = ['network_id', 'router_id']

View File

@ -38,6 +38,8 @@ class IpamAllocationPool(base.NeutronDbObject):
'last_ip': obj_fields.IPAddressField(),
}
fields_no_update = ['ipam_subnet_id']
@classmethod
def modify_fields_from_db(cls, db_obj):
result = super(IpamAllocationPool, cls).modify_fields_from_db(db_obj)

View File

@ -38,6 +38,8 @@ class MeteringLabelRule(base.NeutronDbObject):
'excluded': obj_fields.BooleanField(default=False),
}
fields_no_update = ['metering_label_id']
@classmethod
def modify_fields_from_db(cls, db_obj):
result = super(MeteringLabelRule, cls).modify_fields_from_db(db_obj)

View File

@ -52,6 +52,8 @@ class NetworkSegment(base.NeutronDbObject):
synthetic_fields = ['hosts']
fields_no_update = ['network_id']
foreign_keys = {
'Network': {'network_id': 'id'},
'PortBindingLevel': {'id': 'segment_id'},

View File

@ -33,6 +33,8 @@ class ExtraDhcpOpt(base.NeutronDbObject):
'ip_version': obj_fields.IntegerField(),
}
fields_no_update = ['port_id']
foreign_keys = {
'Port': {'port_id': 'id'},
}

View File

@ -156,6 +156,8 @@ class IPAllocation(base.NeutronDbObject):
'ip_address': obj_fields.IPAddressField(),
}
fields_no_update = fields.keys()
primary_keys = ['subnet_id', 'network_id', 'ip_address']
foreign_keys = {
@ -261,6 +263,8 @@ class Port(base.NeutronDbObject):
# field in later object iterations
}
fields_no_update = ['project_id', 'network_id']
synthetic_fields = [
'allowed_address_pairs',
'binding',

View File

@ -104,7 +104,7 @@ class SecurityGroupRule(base.NeutronDbObject):
foreign_keys = {'SecurityGroup': {'security_group_id': 'id'}}
fields_no_update = ['project_id', 'security_group_id']
fields_no_update = ['project_id', 'security_group_id', 'remote_group_id']
# TODO(sayalilunkad): get rid of it once we switch the db model to using
# custom types.

View File

@ -116,6 +116,8 @@ class IPAllocationPool(base.NeutronDbObject):
'end': obj_fields.IPAddressField()
}
fields_no_update = ['subnet_id']
@classmethod
def modify_fields_from_db(cls, db_obj):
# TODO(korzen) remove this method when IP and CIDR decorator ready
@ -195,7 +197,7 @@ class Subnet(base.NeutronDbObject):
foreign_keys = {'Network': {'network_id': 'id'}}
fields_no_update = ['project_id']
fields_no_update = ['project_id', 'network_id', 'segment_id']
fields_need_translation = {
'host_routes': 'routes'

View File

@ -44,7 +44,7 @@ class SubPort(base.NeutronDbObject):
'segmentation_id': obj_fields.IntegerField(),
}
fields_no_update = ['segmentation_type', 'segmentation_id']
fields_no_update = ['segmentation_type', 'segmentation_id', 'trunk_id']
def to_dict(self):
_dict = super(SubPort, self).to_dict()