Merge "Use 'port' instead of 'ports' to reference port from IPAllocation"

This commit is contained in:
Jenkins 2015-04-15 16:35:08 +00:00 committed by Gerrit Code Review
commit 354ae7c1d3
2 changed files with 3 additions and 3 deletions

View File

@ -132,7 +132,7 @@ class Port(model_base.BASEV2, HasId, HasTenant):
name = sa.Column(sa.String(attr.NAME_MAX_LEN))
network_id = sa.Column(sa.String(36), sa.ForeignKey("networks.id"),
nullable=False)
fixed_ips = orm.relationship(IPAllocation, backref='ports', lazy='joined')
fixed_ips = orm.relationship(IPAllocation, backref='port', lazy='joined')
mac_address = sa.Column(sa.String(32), nullable=False)
admin_state_up = sa.Column(sa.Boolean(), nullable=False)
status = sa.Column(sa.String(16), nullable=False)

View File

@ -884,7 +884,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
"having IP allocation on subnet "
"%(subnet)s, cannot delete"),
{'ip': user_alloc.ip_address,
'port_id': user_alloc.ports.id,
'port_id': user_alloc.port_id,
'subnet': id})
raise exc.SubnetInUse(subnet_id=id)
else:
@ -915,7 +915,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
data = {attributes.PORT:
{'fixed_ips': [{'subnet_id': ip.subnet_id,
'ip_address': ip.ip_address}
for ip in a.ports.fixed_ips
for ip in a.port.fixed_ips
if ip.subnet_id != id]}}
try:
self.update_port(context, a.port_id, data)