trunk: avoid redundant refetch of subports on create
Instead of triggering refetch for added sub ports, just populate the sub_ports fields with objects we already have. Change-Id: Idefa57323687619a63ff5cb8a57d6600413f7271 Partially-Implements: bp/adopt-oslo-versioned-objects-for-db
This commit is contained in:
parent
f03693fdc8
commit
2d2689f3fa
|
@ -111,10 +111,12 @@ class Trunk(base.NeutronDbObject):
|
|||
except o_db_exc.DBReferenceError:
|
||||
raise n_exc.PortNotFound(port_id=self.port_id)
|
||||
|
||||
for sub_port in sub_ports:
|
||||
sub_port.trunk_id = self.id
|
||||
sub_port.create()
|
||||
self.load_synthetic_db_fields()
|
||||
if sub_ports:
|
||||
for sub_port in sub_ports:
|
||||
sub_port.trunk_id = self.id
|
||||
sub_port.create()
|
||||
self.sub_ports.append(sub_port)
|
||||
self.obj_reset_changes(['sub_ports'])
|
||||
|
||||
# TODO(ivc): add support for 'sub_ports' in 'Trunk.update' for
|
||||
# consistency with 'Trunk.create'
|
||||
|
|
Loading…
Reference in New Issue