Merge "Enable DHCP agent to work with plugin when L2 agents use DB polling"

This commit is contained in:
Jenkins 2012-08-21 17:26:13 +00:00 committed by Gerrit Code Review
commit d15151d42a
2 changed files with 10 additions and 12 deletions

View File

@ -156,8 +156,7 @@ 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.agent_rpc = cfg.CONF.AGENT.rpc
self._setup_rpc()
LOG.debug("Linux Bridge Plugin initialization complete")
@ -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'])

View File

@ -197,8 +197,7 @@ 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.agent_rpc = cfg.CONF.AGENT.rpc
self.setup_rpc()
def setup_rpc(self):
@ -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)