Skip to content

Commit

Permalink
Rebind security groups only when they're updated
Browse files Browse the repository at this point in the history
Update the security port bindings for a port only when they actually
differ from the stored value.

This will also avoid sending port_update notifications to the agent
even if nothing actually changes in the port configuration.

Closes-Bug: #1255183
Partial blueprint: neutron-tempest-parallel

Change-Id: I00c29dc97c46478433fdf08069a884bb78e5cd0a
  • Loading branch information
salv-orlando committed Nov 27, 2013
1 parent 4b47717 commit 1211894
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions neutron/db/securitygroups_rpc_base.py
Expand Up @@ -70,15 +70,19 @@ def update_security_group_on_port(self, context, id, port,
It is because another changes for the port may require notification.
"""
need_notify = False
if ext_sg.SECURITYGROUPS in port['port']:
port_updates = port['port']
if (ext_sg.SECURITYGROUPS in port_updates and
not utils.compare_elements(
original_port.get(ext_sg.SECURITYGROUPS),
port_updates[ext_sg.SECURITYGROUPS])):
# delete the port binding and read it with the new rules
port['port'][ext_sg.SECURITYGROUPS] = (
port_updates[ext_sg.SECURITYGROUPS] = (
self._get_security_groups_on_port(context, port))
self._delete_port_security_group_bindings(context, id)
self._process_port_create_security_group(
context,
updated_port,
port['port'][ext_sg.SECURITYGROUPS])
port_updates[ext_sg.SECURITYGROUPS])
need_notify = True
else:
updated_port[ext_sg.SECURITYGROUPS] = (
Expand Down

0 comments on commit 1211894

Please sign in to comment.