Merge "Notify creation or deletion of dhcp port for security group"
This commit is contained in:
commit
1007c27c51
@ -96,11 +96,28 @@ class SecurityGroupServerRpcMixin(sg_db.SecurityGroupDbMixin):
|
|||||||
not utils.compare_elements(
|
not utils.compare_elements(
|
||||||
original_port.get(ext_sg.SECURITYGROUPS),
|
original_port.get(ext_sg.SECURITYGROUPS),
|
||||||
updated_port.get(ext_sg.SECURITYGROUPS))):
|
updated_port.get(ext_sg.SECURITYGROUPS))):
|
||||||
self.notifier.security_groups_member_updated(
|
self.notify_security_groups_member_updated(
|
||||||
context, updated_port.get(ext_sg.SECURITYGROUPS))
|
context, updated_port)
|
||||||
need_notify = True
|
need_notify = True
|
||||||
return need_notify
|
return need_notify
|
||||||
|
|
||||||
|
def notify_security_groups_member_updated(self, context, port):
|
||||||
|
""" notify update event of security group members
|
||||||
|
|
||||||
|
The agent setups the iptables rule to allow
|
||||||
|
ingress packet from the dhcp server (as a part of provider rules),
|
||||||
|
so we need to notify an update of dhcp server ip
|
||||||
|
address to the plugin agent.
|
||||||
|
security_groups_provider_updated() just notifies that an event
|
||||||
|
occurs and the plugin agent fetches the update provider
|
||||||
|
rule in the other RPC call (security_group_rules_for_devices).
|
||||||
|
"""
|
||||||
|
if port['device_owner'] == q_const.DEVICE_OWNER_DHCP:
|
||||||
|
self.notifier.security_groups_provider_updated(context)
|
||||||
|
else:
|
||||||
|
self.notifier.security_groups_member_updated(
|
||||||
|
context, port.get(ext_sg.SECURITYGROUPS))
|
||||||
|
|
||||||
|
|
||||||
class SecurityGroupServerRpcCallbackMixin(object):
|
class SecurityGroupServerRpcCallbackMixin(object):
|
||||||
"""A mix-in that enable SecurityGroup agent
|
"""A mix-in that enable SecurityGroup agent
|
||||||
|
@ -506,11 +506,7 @@ class LinuxBridgePluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
|||||||
self._process_port_create_security_group(
|
self._process_port_create_security_group(
|
||||||
context, port['id'], sgids)
|
context, port['id'], sgids)
|
||||||
self._extend_port_dict_security_group(context, port)
|
self._extend_port_dict_security_group(context, port)
|
||||||
if port['device_owner'] == q_const.DEVICE_OWNER_DHCP:
|
self.notify_security_groups_member_updated(context, port)
|
||||||
self.notifier.security_groups_provider_updated(context)
|
|
||||||
else:
|
|
||||||
self.notifier.security_groups_member_updated(
|
|
||||||
context, port.get(ext_sg.SECURITYGROUPS))
|
|
||||||
return self._extend_port_dict_binding(context, port)
|
return self._extend_port_dict_binding(context, port)
|
||||||
|
|
||||||
def update_port(self, context, id, port):
|
def update_port(self, context, id, port):
|
||||||
@ -548,8 +544,7 @@ class LinuxBridgePluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
|||||||
self._delete_port_security_group_bindings(context, id)
|
self._delete_port_security_group_bindings(context, id)
|
||||||
super(LinuxBridgePluginV2, self).delete_port(context, id)
|
super(LinuxBridgePluginV2, self).delete_port(context, id)
|
||||||
|
|
||||||
self.notifier.security_groups_member_updated(
|
self.notify_security_groups_member_updated(context, port)
|
||||||
context, port.get(ext_sg.SECURITYGROUPS))
|
|
||||||
|
|
||||||
def _notify_port_updated(self, context, port):
|
def _notify_port_updated(self, context, port):
|
||||||
binding = db.get_network_binding(context.session,
|
binding = db.get_network_binding(context.session,
|
||||||
|
@ -383,14 +383,7 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base,
|
|||||||
self._process_port_create_security_group(
|
self._process_port_create_security_group(
|
||||||
context, port['id'], sgids)
|
context, port['id'], sgids)
|
||||||
self._extend_port_dict_security_group(context, port)
|
self._extend_port_dict_security_group(context, port)
|
||||||
# Note: In order to allow dhcp packets,
|
self.notify_security_groups_member_updated(context, port)
|
||||||
# changes for dhcp ip should be notifified
|
|
||||||
if port['device_owner'] == q_const.DEVICE_OWNER_DHCP:
|
|
||||||
self.notifier.security_groups_provider_updated(context)
|
|
||||||
else:
|
|
||||||
self.notifier.security_groups_member_updated(
|
|
||||||
context, port.get(ext_sg.SECURITYGROUPS))
|
|
||||||
|
|
||||||
self._update_resource_status(context, "port", port['id'],
|
self._update_resource_status(context, "port", port['id'],
|
||||||
OperationalStatus.BUILD)
|
OperationalStatus.BUILD)
|
||||||
self.activate_port_if_ready(context, port)
|
self.activate_port_if_ready(context, port)
|
||||||
@ -455,8 +448,7 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base,
|
|||||||
self.disassociate_floatingips(context, id)
|
self.disassociate_floatingips(context, id)
|
||||||
self._delete_port_security_group_bindings(context, id)
|
self._delete_port_security_group_bindings(context, id)
|
||||||
super(NECPluginV2, self).delete_port(context, id)
|
super(NECPluginV2, self).delete_port(context, id)
|
||||||
self.notifier.security_groups_member_updated(
|
self.notify_security_groups_member_updated(context, port)
|
||||||
context, port.get(ext_sg.SECURITYGROUPS))
|
|
||||||
|
|
||||||
def get_port(self, context, id, fields=None):
|
def get_port(self, context, id, fields=None):
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
|
@ -569,13 +569,7 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
|||||||
self._process_port_create_security_group(
|
self._process_port_create_security_group(
|
||||||
context, port['id'], sgids)
|
context, port['id'], sgids)
|
||||||
self._extend_port_dict_security_group(context, port)
|
self._extend_port_dict_security_group(context, port)
|
||||||
#Note(nati): In order to allow dhcp packets,
|
self.notify_security_groups_member_updated(context, port)
|
||||||
# changes for dhcp ip should be notifified
|
|
||||||
if port['device_owner'] == q_const.DEVICE_OWNER_DHCP:
|
|
||||||
self.notifier.security_groups_provider_updated(context)
|
|
||||||
else:
|
|
||||||
self.notifier.security_groups_member_updated(
|
|
||||||
context, port.get(ext_sg.SECURITYGROUPS))
|
|
||||||
return self._extend_port_dict_binding(context, port)
|
return self._extend_port_dict_binding(context, port)
|
||||||
|
|
||||||
def get_port(self, context, id, fields=None):
|
def get_port(self, context, id, fields=None):
|
||||||
@ -641,5 +635,4 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
|||||||
self._delete_port_security_group_bindings(context, id)
|
self._delete_port_security_group_bindings(context, id)
|
||||||
super(OVSQuantumPluginV2, self).delete_port(context, id)
|
super(OVSQuantumPluginV2, self).delete_port(context, id)
|
||||||
|
|
||||||
self.notifier.security_groups_member_updated(
|
self.notify_security_groups_member_updated(context, port)
|
||||||
context, port.get(ext_sg.SECURITYGROUPS))
|
|
||||||
|
@ -198,11 +198,7 @@ class RyuQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
|||||||
self._process_port_create_security_group(
|
self._process_port_create_security_group(
|
||||||
context, port['id'], sgids)
|
context, port['id'], sgids)
|
||||||
self._extend_port_dict_security_group(context, port)
|
self._extend_port_dict_security_group(context, port)
|
||||||
if port['device_owner'] == q_const.DEVICE_OWNER_DHCP:
|
self.notify_security_groups_member_updated(context, port)
|
||||||
self.notifier.security_groups_provider_updated(context)
|
|
||||||
else:
|
|
||||||
self.notifier.security_groups_member_updated(
|
|
||||||
context, port.get(ext_sg.SECURITYGROUPS))
|
|
||||||
self.iface_client.create_network_id(port['id'], port['network_id'])
|
self.iface_client.create_network_id(port['id'], port['network_id'])
|
||||||
return port
|
return port
|
||||||
|
|
||||||
@ -218,8 +214,7 @@ class RyuQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
|||||||
self._delete_port_security_group_bindings(context, id)
|
self._delete_port_security_group_bindings(context, id)
|
||||||
super(RyuQuantumPluginV2, self).delete_port(context, id)
|
super(RyuQuantumPluginV2, self).delete_port(context, id)
|
||||||
|
|
||||||
self.notifier.security_groups_member_updated(
|
self.notify_security_groups_member_updated(context, port)
|
||||||
context, port.get(ext_sg.SECURITYGROUPS))
|
|
||||||
|
|
||||||
def update_port(self, context, id, port):
|
def update_port(self, context, id, port):
|
||||||
deleted = port['port'].get('deleted', False)
|
deleted = port['port'].get('deleted', False)
|
||||||
|
Loading…
Reference in New Issue
Block a user