]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Enable DHCP agent to work with plugin when L2 agents use DB polling
authorGary Kotton <gkotton@redhat.com>
Tue, 21 Aug 2012 07:07:39 +0000 (03:07 -0400)
committerGary Kotton <gkotton@redhat.com>
Tue, 21 Aug 2012 07:07:39 +0000 (03:07 -0400)
Fixes bug 1039393

By default the plugins will enable the RPC support. If and only if
the agent RPC is enabled will RPC notification messages be sent to the
agents

Change-Id: I4fb003a2b477e5e647c3ee408b449e71b3f5a883

quantum/plugins/linuxbridge/lb_quantum_plugin.py
quantum/plugins/openvswitch/ovs_quantum_plugin.py

index d657ce951b9a8f83d044233fbb4ad33d07fe74d0..8504cbeadfc44440bec40d1716974c4e94a1a510 100644 (file)
@@ -156,9 +156,8 @@ class LinuxBridgePluginV2(db_base_plugin_v2.QuantumDbPluginV2):
         db.initialize()
         self._parse_network_vlan_ranges()
         db.sync_network_states(self.network_vlan_ranges)
-        self.rpc = cfg.CONF.AGENT.rpc
-        if self.rpc:
-            self._setup_rpc()
+        self.agent_rpc = cfg.CONF.AGENT.rpc
+        self._setup_rpc()
         LOG.debug("Linux Bridge Plugin initialization complete")
 
     def _setup_rpc(self):
@@ -326,7 +325,7 @@ class LinuxBridgePluginV2(db_base_plugin_v2.QuantumDbPluginV2):
                                binding.vlan_id, self.network_vlan_ranges)
             # the network_binding record is deleted via cascade from
             # the network record, so explicit removal is not necessary
-        if self.rpc:
+        if self.agent_rpc:
             self.notifier.network_delete(self.rpc_context, id)
 
     def get_network(self, context, id, fields=None, verbose=None):
@@ -344,11 +343,11 @@ class LinuxBridgePluginV2(db_base_plugin_v2.QuantumDbPluginV2):
         return [self._fields(net, fields) for net in nets]
 
     def update_port(self, context, id, port):
-        if self.rpc:
+        if self.agent_rpc:
             original_port = super(LinuxBridgePluginV2, self).get_port(context,
                                                                       id)
         port = super(LinuxBridgePluginV2, self).update_port(context, id, port)
-        if self.rpc:
+        if self.agent_rpc:
             if original_port['admin_state_up'] != port['admin_state_up']:
                 binding = db.get_network_binding(context.session,
                                                  port['network_id'])
index 2e966b21d7c6008cc65f0fc591d913cad35c0f3e..8a70729841d32b1e5c4425b2b451976075112f20 100644 (file)
@@ -197,9 +197,8 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
 
         # update the vlan_id table based on current configuration
         ovs_db_v2.update_vlan_id_pool()
-        self.rpc = cfg.CONF.AGENT.rpc
-        if cfg.CONF.AGENT.rpc:
-            self.setup_rpc()
+        self.agent_rpc = cfg.CONF.AGENT.rpc
+        self.setup_rpc()
 
     def setup_rpc(self):
         # RPC support
@@ -335,7 +334,7 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
         vlan_id = ovs_db_v2.get_vlan(id)
         result = super(OVSQuantumPluginV2, self).delete_network(context, id)
         ovs_db_v2.release_vlan_id(vlan_id)
-        if self.rpc:
+        if self.agent_rpc:
             self.notifier.network_delete(self.context, id)
         return result
 
@@ -354,11 +353,11 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
         return [self._fields(net, fields) for net in nets]
 
     def update_port(self, context, id, port):
-        if self.rpc:
+        if self.agent_pc:
             original_port = super(OVSQuantumPluginV2, self).get_port(context,
                                                                      id)
         port = super(OVSQuantumPluginV2, self).update_port(context, id, port)
-        if self.rpc:
+        if self.agent_rpc:
             if original_port['admin_state_up'] != port['admin_state_up']:
                 vlan_id = ovs_db_v2.get_vlan(port['network_id'])
                 self.notifier.port_update(self.context, port, vlan_id)