Browse Source

Fix OVSvApp the missing OVS RPC related calls.

Fix all the missing RPC calls related to
'security_groups_member_updated' and
'security_groups_rule_updated'.

Also fixed the 'notifier' AttributeError exception
in the OVSvAppSecurityGroupServerRpcMixin class.

Change-Id: I688216e1a7ddfe5a55aa1341e84bc89f79d4ead4
Stephen Ma 1 year ago
parent
commit
cdcb9cc3ca
2 changed files with 40 additions and 0 deletions
  1. 16
    0
      networking_vsphere/agent/ovsvapp_agent.py
  2. 24
    0
      networking_vsphere/ml2/ovsvapp_rpc.py

+ 16
- 0
networking_vsphere/agent/ovsvapp_agent.py View File

@@ -1873,6 +1873,22 @@ class OVSvAppAgent(agent.Agent, ovs_agent.OVSNeutronAgent):
1873 1873
                 LOG.debug("Ignoring the device_update RPC as it is for "
1874 1874
                           "a different host")
1875 1875
 
1876
+    def security_groups_member_updated(self, context, **kwargs):
1877
+        """Callback for security group member updated RPC."""
1878
+        security_groups = kwargs.get('security_groups', [])
1879
+        LOG.info(_LI("Received security_groups_member_updated RPC for "
1880
+                     "security group %s"),
1881
+                 security_groups)
1882
+        self.sg_agent.security_groups_member_updated(security_groups)
1883
+
1884
+    def security_groups_rule_updated(self, context, **kwargs):
1885
+        """Callback from security groups rule updated RPC."""
1886
+        security_groups = kwargs.get('security_groups', [])
1887
+        LOG.info(_LI("Received security_groups_rule_updated RPC for "
1888
+                     "security group %s"),
1889
+                 security_groups)
1890
+        self.sg_agent.security_groups_rule_updated(security_groups)
1891
+
1876 1892
     def enhanced_sg_provider_updated(self, context, **kwargs):
1877 1893
         """Callback for security group provider update."""
1878 1894
         net_id = kwargs.get('network_id', [])

+ 24
- 0
networking_vsphere/ml2/ovsvapp_rpc.py View File

@@ -78,6 +78,10 @@ class OVSvAppSecurityGroupServerRpcMixin(
78 78
         sg_rpc_base.SecurityGroupServerRpcMixin):
79 79
     """Mixin class to add agent-based security group implementation."""
80 80
 
81
+    def __init__(self):
82
+        super(OVSvAppSecurityGroupServerRpcMixin, self).__init__()
83
+        self.notifier = OVSvAppAgentNotifyAPI(topics.AGENT)
84
+
81 85
     def _select_remote_group_ids(self, ports):
82 86
         remote_group_ids = []
83 87
         for port in ports.values():
@@ -539,6 +543,26 @@ class OVSvAppAgentNotifyAPI(object):
539 543
                    network_info=network_info, host=host,
540 544
                    cluster_id=cluster_id)
541 545
 
546
+    def security_groups_member_updated(self, context, security_groups):
547
+        sg_topic = ovsvapp_const.OVSVAPP + '_' + topics.SECURITY_GROUP
548
+        cctxt = self.client.prepare(
549
+            topic=topics.get_topic_name(self.topic,
550
+                                        sg_topic,
551
+                                        topics.UPDATE),
552
+            fanout=True)
553
+        cctxt.cast(context, 'security_groups_member_updated',
554
+                   security_groups=security_groups)
555
+
556
+    def security_groups_rule_updated(self, context, security_groups):
557
+        sg_topic = ovsvapp_const.OVSVAPP + '_' + topics.SECURITY_GROUP
558
+        cctxt = self.client.prepare(
559
+            topic=topics.get_topic_name(self.topic,
560
+                                        sg_topic,
561
+                                        topics.UPDATE),
562
+            fanout=True)
563
+        cctxt.cast(context, 'security_groups_rule_updated',
564
+                   security_groups=security_groups)
565
+
542 566
     def enhanced_sg_provider_updated(self, context, network_id):
543 567
         sg_topic = ovsvapp_const.OVSVAPP + '_' + topics.SECURITY_GROUP
544 568
         cctxt = self.client.prepare(

Loading…
Cancel
Save