From 5b2f47c3463f520609490b616d68ddab40d74570 Mon Sep 17 00:00:00 2001 From: gongysh Date: Thu, 13 Dec 2012 15:45:58 +0800 Subject: [PATCH] Make patch-tun and patch-int configurable Bug #1089777 Change-Id: Ib72d352374fb59029b6b0719a2d1254597f193ff --- etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini | 6 ++++++ quantum/plugins/openvswitch/agent/ovs_quantum_agent.py | 10 +++++----- quantum/plugins/openvswitch/common/config.py | 4 ++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini b/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini index 4b46a8316..f8956a1c7 100644 --- a/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini +++ b/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini @@ -60,6 +60,12 @@ reconnect_interval = 2 # # Default: tunnel_bridge = br-tun +# Peer patch port in integration bridge for tunnel bridge +# int_peer_patch_port = patch-tun + +# Peer patch port in tunnel bridge for integration bridge +# tun_peer_patch_port = patch-int + # Uncomment this line for the agent if tunnel_id_ranges (above) is not # empty for the server. Set local-ip to be the local IP address of # this hypervisor. diff --git a/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py b/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py index 3ab8f25f5..57c59de34 100755 --- a/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py +++ b/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py @@ -435,7 +435,7 @@ class OVSQuantumAgent(object): :returns: the integration bridge ''' int_br = ovs_lib.OVSBridge(bridge_name, self.root_helper) - int_br.delete_port("patch-tun") + int_br.delete_port(cfg.CONF.OVS.int_peer_patch_port) int_br.remove_all_flows() # switch all traffic using L2 learning int_br.add_flow(priority=1, actions="normal") @@ -450,10 +450,10 @@ class OVSQuantumAgent(object): :param tun_br: the name of the tunnel bridge.''' self.tun_br = ovs_lib.OVSBridge(tun_br, self.root_helper) self.tun_br.reset_bridge() - self.patch_tun_ofport = self.int_br.add_patch_port("patch-tun", - "patch-int") - self.patch_int_ofport = self.tun_br.add_patch_port("patch-int", - "patch-tun") + self.patch_tun_ofport = self.int_br.add_patch_port( + cfg.CONF.OVS.int_peer_patch_port, cfg.CONF.OVS.tun_peer_patch_port) + self.patch_int_ofport = self.tun_br.add_patch_port( + cfg.CONF.OVS.tun_peer_patch_port, cfg.CONF.OVS.int_peer_patch_port) if int(self.patch_tun_ofport) < 0 or int(self.patch_int_ofport) < 0: LOG.error(_("Failed to create OVS patch port. Cannot have " "tunneling enabled on this agent, since this version " diff --git a/quantum/plugins/openvswitch/common/config.py b/quantum/plugins/openvswitch/common/config.py index 4859ecf04..0a1af1dcc 100644 --- a/quantum/plugins/openvswitch/common/config.py +++ b/quantum/plugins/openvswitch/common/config.py @@ -31,6 +31,10 @@ ovs_opts = [ cfg.StrOpt('integration_bridge', default='br-int'), cfg.BoolOpt('enable_tunneling', default=False), cfg.StrOpt('tunnel_bridge', default='br-tun'), + cfg.StrOpt('int_peer_patch_port', default='patch-tun', + help="Peer patch port in integration bridge for tunnel bridge"), + cfg.StrOpt('tun_peer_patch_port', default='patch-int', + help="Peer patch port in tunnel bridge for integration bridge"), cfg.StrOpt('local_ip', default=''), cfg.ListOpt('bridge_mappings', default=DEFAULT_BRIDGE_MAPPINGS, -- 2.45.2