many plugins still add binding information by iterating once more:
def get_port(self, context, port_id, fields=None):
with context.session.begin(subtransactions=True):
port = super(BrocadePluginV2, self).get_port(
context, port_id, fields)
self._extend_port_dict_binding(context, port)
return self._fields(port, fields)
def get_ports(self, context, filters=None, fields=None):
res_ports = []
with context.session.begin(subtransactions=True):
ports = super(BrocadePluginV2, self).get_ports(context,
filters,
fields)
for port in ports:
self._extend_port_dict_binding(context, port)
res_ports.append(self._fields(port, fields))
return res_ports
Reviewed: https:/ /review. openstack. org/34133 github. com/openstack/ neutron/ commit/ 76fc0addc985195 dc6fddd78c9030c c5d24cfe88
Committed: http://
Submitter: Jenkins
Branch: master
commit 76fc0addc985195 dc6fddd78c9030c c5d24cfe88
Author: Yong Sheng Gong <email address hidden>
Date: Tue Jul 23 13:21:24 2013 +0800
refactor port binding codes
Bug #1195047
This patch:
1. removes the iteration in get_ports to call extend_dict_binding
2. uses a unified way for plugins to do this kind of stuff
ml2 will enhance the binding so that it can have different binding
for port according to port's host.
mlnx and bigswitch are also exceptions due to the dynamic binding info.
Change-Id: I5a77eb7395e144 82a856e033f536f 72a1bf82e06