diff options
author | Gary Kotton <gkotton@vmware.com> | 2013-09-29 07:11:49 -0700 |
---|---|---|
committer | Gary Kotton <gkotton@vmware.com> | 2013-09-29 10:29:32 -0700 |
commit | 01debad5665bcae5c0f4745759ae744f85daa723 (patch) | |
tree | d1838de67787104728b0dd108c2e2d09a99a8fbb /neutron/agent/securitygroups_rpc.py | |
parent | 791de592d7eff9ac3baf7045035ea0bcc74a3f8c (diff) | |
download | neutron-01debad5665bcae5c0f4745759ae744f85daa723.tar.gz |
Ensure that security group agent is bound prior to accessing
When the Neutron agents start and the security group agent callbacks
are not registered there may be exceptions.
Fixes bug: #1232758
Change-Id: I4c1ff96b8acfcee4c84a73c9400040c96f8418a9
Diffstat (limited to 'neutron/agent/securitygroups_rpc.py')
-rw-r--r-- | neutron/agent/securitygroups_rpc.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/neutron/agent/securitygroups_rpc.py b/neutron/agent/securitygroups_rpc.py index 04d6ef50ea..a38e4355bf 100644 --- a/neutron/agent/securitygroups_rpc.py +++ b/neutron/agent/securitygroups_rpc.py @@ -65,6 +65,11 @@ class SecurityGroupAgentRpcCallbackMixin(object): #mix-in object should be have sg_agent sg_agent = None + def _security_groups_agent_not_set(self): + LOG.warning(_("Security group agent binding currently not set. " + "This should be set by the end of the init " + "process.")) + def security_groups_rule_updated(self, context, **kwargs): """Callback for security group rule update. @@ -73,6 +78,8 @@ class SecurityGroupAgentRpcCallbackMixin(object): security_groups = kwargs.get('security_groups', []) LOG.debug( _("Security group rule updated on remote: %s"), security_groups) + if not self.sg_agent: + return self._security_groups_agent_not_set() self.sg_agent.security_groups_rule_updated(security_groups) def security_groups_member_updated(self, context, **kwargs): @@ -83,11 +90,15 @@ class SecurityGroupAgentRpcCallbackMixin(object): security_groups = kwargs.get('security_groups', []) LOG.debug( _("Security group member updated on remote: %s"), security_groups) + if not self.sg_agent: + return self._security_groups_agent_not_set() self.sg_agent.security_groups_member_updated(security_groups) def security_groups_provider_updated(self, context, **kwargs): """Callback for security group provider update.""" LOG.debug(_("Provider rule updated")) + if not self.sg_agent: + return self._security_groups_agent_not_set() self.sg_agent.security_groups_provider_updated() |