From: Gary Kotton Date: Tue, 21 Aug 2012 07:07:39 +0000 (-0400) Subject: Enable DHCP agent to work with plugin when L2 agents use DB polling X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c8a7ece1e3af84b845bbdbb913ff0f31dd242269;p=openstack-build%2Fneutron-build.git Enable DHCP agent to work with plugin when L2 agents use DB polling 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 --- diff --git a/quantum/plugins/linuxbridge/lb_quantum_plugin.py b/quantum/plugins/linuxbridge/lb_quantum_plugin.py index d657ce951..8504cbead 100644 --- a/quantum/plugins/linuxbridge/lb_quantum_plugin.py +++ b/quantum/plugins/linuxbridge/lb_quantum_plugin.py @@ -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']) diff --git a/quantum/plugins/openvswitch/ovs_quantum_plugin.py b/quantum/plugins/openvswitch/ovs_quantum_plugin.py index 2e966b21d..8a7072984 100644 --- a/quantum/plugins/openvswitch/ovs_quantum_plugin.py +++ b/quantum/plugins/openvswitch/ovs_quantum_plugin.py @@ -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)