From b8b2c4ebec7f8687215b5fd17a6f0fde84aee043 Mon Sep 17 00:00:00 2001 From: Zhongyue Luo Date: Wed, 22 May 2013 00:37:00 +0800 Subject: [PATCH] Reference OVS OptGoup names in lowercase To have consistent option group name format across projects, oslo.config now normalizes all non lowercase group names to lowercase when loading conf files. Thus conf files are backwards compatible but option group references in the code must now use lowercase before we update oslo.config. This patch replaces all 'OVS' references to 'ovs' Change-Id: Id8697138d822e331a6776f847915c61b40f8dd6a --- etc/quantum/plugins/nec/nec.ini | 2 +- .../plugins/openvswitch/ovs_quantum_plugin.ini | 6 +++--- etc/quantum/plugins/ryu/ryu.ini | 2 +- quantum/plugins/nec/agent/nec_quantum_agent.py | 2 +- quantum/plugins/nec/common/config.py | 6 +++--- .../openvswitch/agent/ovs_quantum_agent.py | 16 ++++++++-------- quantum/plugins/openvswitch/common/config.py | 2 +- .../plugins/openvswitch/ovs_quantum_plugin.py | 8 ++++---- quantum/plugins/ryu/agent/ryu_quantum_agent.py | 8 ++++---- quantum/plugins/ryu/common/config.py | 2 +- quantum/plugins/ryu/ryu_quantum_plugin.py | 4 ++-- quantum/tests/unit/cisco/test_network_plugin.py | 2 +- quantum/tests/unit/nec/test_config.py | 2 +- .../tests/unit/openvswitch/test_ovs_defaults.py | 14 +++++++------- .../unit/openvswitch/test_ovs_quantum_agent.py | 2 +- quantum/tests/unit/ryu/test_defaults.py | 10 +++++----- quantum/tests/unit/ryu/test_ryu_agent.py | 10 +++++----- 17 files changed, 49 insertions(+), 49 deletions(-) diff --git a/etc/quantum/plugins/nec/nec.ini b/etc/quantum/plugins/nec/nec.ini index 21737c5058..9ceb09e1da 100644 --- a/etc/quantum/plugins/nec/nec.ini +++ b/etc/quantum/plugins/nec/nec.ini @@ -23,7 +23,7 @@ reconnect_interval = 2 # Timeout in seconds before idle sql connections are reaped # sql_idle_timeout = 3600 -[OVS] +[ovs] # Do not change this parameter unless you have a good reason to. # This is the name of the OVS integration bridge. There is one per hypervisor. # The integration bridge acts as a virtual "patch port". All VM VIFs are diff --git a/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini b/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini index d0e1527b84..4138653029 100644 --- a/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini +++ b/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini @@ -21,7 +21,7 @@ reconnect_interval = 2 # Timeout in seconds before idle sql connections are reaped # sql_idle_timeout = 3600 -[OVS] +[ovs] # (StrOpt) Type of network to allocate for tenant networks. The # default value 'local' is useful only for single-box testing and # provides no connectivity between hosts. You MUST either change this @@ -108,7 +108,7 @@ polling_interval = 2 # 1. With VLANs on eth1. # [DATABASE] # sql_connection = mysql://root:nova@127.0.0.1:3306/ovs_quantum -# [OVS] +# [ovs] # network_vlan_ranges = default:2000:3999 # tunnel_id_ranges = # integration_bridge = br-int @@ -119,7 +119,7 @@ polling_interval = 2 # 2. With tunneling. # [DATABASE] # sql_connection = mysql://root:nova@127.0.0.1:3306/ovs_quantum -# [OVS] +# [ovs] # network_vlan_ranges = # tunnel_id_ranges = 1:1000 # integration_bridge = br-int diff --git a/etc/quantum/plugins/ryu/ryu.ini b/etc/quantum/plugins/ryu/ryu.ini index 288d703c11..eb4c7ac583 100644 --- a/etc/quantum/plugins/ryu/ryu.ini +++ b/etc/quantum/plugins/ryu/ryu.ini @@ -13,7 +13,7 @@ sql_connection = sqlite:// # Timeout in seconds before idle sql connections are reaped # sql_idle_timeout = 3600 -[OVS] +[ovs] integration_bridge = br-int # openflow_rest_api = : diff --git a/quantum/plugins/nec/agent/nec_quantum_agent.py b/quantum/plugins/nec/agent/nec_quantum_agent.py index 00f1dd687c..d025cdc839 100755 --- a/quantum/plugins/nec/agent/nec_quantum_agent.py +++ b/quantum/plugins/nec/agent/nec_quantum_agent.py @@ -233,7 +233,7 @@ def main(): logging_config.setup_logging(config.CONF) # Determine which agent type to use. - integ_br = config.OVS.integration_bridge + integ_br = config.ovs.integration_bridge root_helper = config.AGENT.root_helper polling_interval = config.AGENT.polling_interval diff --git a/quantum/plugins/nec/common/config.py b/quantum/plugins/nec/common/config.py index 8229a9f511..00a8d7abdc 100644 --- a/quantum/plugins/nec/common/config.py +++ b/quantum/plugins/nec/common/config.py @@ -51,7 +51,7 @@ ofc_opts = [ ] -cfg.CONF.register_opts(ovs_opts, "OVS") +cfg.CONF.register_opts(ovs_opts, "ovs") cfg.CONF.register_opts(agent_opts, "AGENT") cfg.CONF.register_opts(ofc_opts, "OFC") config.register_agent_state_opts_helper(cfg.CONF) @@ -60,6 +60,6 @@ cfg.CONF.register_opts(scheduler.AGENTS_SCHEDULER_OPTS) # shortcuts CONF = cfg.CONF -OVS = cfg.CONF.OVS -AGENT = cfg.CONF.AGENT +OVS = cfg.CONF.ovs +aGENT = cfg.CONF.AGENT OFC = cfg.CONF.OFC diff --git a/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py b/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py index 6138718e81..25deeb69b1 100644 --- a/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py +++ b/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py @@ -501,7 +501,7 @@ class OVSQuantumAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin): :returns: the integration bridge ''' int_br = ovs_lib.OVSBridge(bridge_name, self.root_helper) - int_br.delete_port(cfg.CONF.OVS.int_peer_patch_port) + 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") @@ -518,9 +518,9 @@ class OVSQuantumAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin): 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( - cfg.CONF.OVS.int_peer_patch_port, cfg.CONF.OVS.tun_peer_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) + 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 " @@ -736,18 +736,18 @@ def create_agent_config_map(config): :returns: a map of agent configuration parameters """ try: - bridge_mappings = q_utils.parse_mappings(config.OVS.bridge_mappings) + bridge_mappings = q_utils.parse_mappings(config.ovs.bridge_mappings) except ValueError as e: raise ValueError(_("Parsing bridge_mappings failed: %s.") % e) kwargs = dict( - integ_br=config.OVS.integration_bridge, - tun_br=config.OVS.tunnel_bridge, - local_ip=config.OVS.local_ip, + integ_br=config.ovs.integration_bridge, + tun_br=config.ovs.tunnel_bridge, + local_ip=config.ovs.local_ip, bridge_mappings=bridge_mappings, root_helper=config.AGENT.root_helper, polling_interval=config.AGENT.polling_interval, - enable_tunneling=config.OVS.enable_tunneling, + enable_tunneling=config.ovs.enable_tunneling, ) if kwargs['enable_tunneling'] and not kwargs['local_ip']: diff --git a/quantum/plugins/openvswitch/common/config.py b/quantum/plugins/openvswitch/common/config.py index 4886974ddf..32fa8c864e 100644 --- a/quantum/plugins/openvswitch/common/config.py +++ b/quantum/plugins/openvswitch/common/config.py @@ -61,7 +61,7 @@ agent_opts = [ ] -cfg.CONF.register_opts(ovs_opts, "OVS") +cfg.CONF.register_opts(ovs_opts, "ovs") cfg.CONF.register_opts(agent_opts, "AGENT") config.register_agent_state_opts_helper(cfg.CONF) config.register_root_helper(cfg.CONF) diff --git a/quantum/plugins/openvswitch/ovs_quantum_plugin.py b/quantum/plugins/openvswitch/ovs_quantum_plugin.py index 70e2a5c55f..d3d14af12e 100644 --- a/quantum/plugins/openvswitch/ovs_quantum_plugin.py +++ b/quantum/plugins/openvswitch/ovs_quantum_plugin.py @@ -263,7 +263,7 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2, ovs_db_v2.initialize() self._parse_network_vlan_ranges() ovs_db_v2.sync_vlan_allocations(self.network_vlan_ranges) - self.tenant_network_type = cfg.CONF.OVS.tenant_network_type + self.tenant_network_type = cfg.CONF.ovs.tenant_network_type if self.tenant_network_type not in [constants.TYPE_LOCAL, constants.TYPE_VLAN, constants.TYPE_GRE, @@ -272,7 +272,7 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2, "Agent terminated!"), self.tenant_network_type) sys.exit(1) - self.enable_tunneling = cfg.CONF.OVS.enable_tunneling + self.enable_tunneling = cfg.CONF.ovs.enable_tunneling self.tunnel_id_ranges = [] if self.enable_tunneling: self._parse_tunnel_id_ranges() @@ -304,14 +304,14 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2, def _parse_network_vlan_ranges(self): try: self.network_vlan_ranges = plugin_utils.parse_network_vlan_ranges( - cfg.CONF.OVS.network_vlan_ranges) + cfg.CONF.ovs.network_vlan_ranges) except Exception as ex: LOG.error(_("%s. Agent terminated!"), ex) sys.exit(1) LOG.info(_("Network VLAN ranges: %s"), self.network_vlan_ranges) def _parse_tunnel_id_ranges(self): - for entry in cfg.CONF.OVS.tunnel_id_ranges: + for entry in cfg.CONF.ovs.tunnel_id_ranges: entry = entry.strip() try: tun_min, tun_max = entry.split(':') diff --git a/quantum/plugins/ryu/agent/ryu_quantum_agent.py b/quantum/plugins/ryu/agent/ryu_quantum_agent.py index 7b5a5a43ef..517b298fbe 100755 --- a/quantum/plugins/ryu/agent/ryu_quantum_agent.py +++ b/quantum/plugins/ryu/agent/ryu_quantum_agent.py @@ -69,7 +69,7 @@ def _get_my_ip(): def _get_ip(cfg_ip_str, cfg_interface_str): ip = None try: - ip = getattr(cfg.CONF.OVS, cfg_ip_str) + ip = getattr(cfg.CONF.ovs, cfg_ip_str) except (cfg.NoSuchOptError, cfg.NoSuchGroupError): pass if ip: @@ -77,7 +77,7 @@ def _get_ip(cfg_ip_str, cfg_interface_str): iface = None try: - iface = getattr(cfg.CONF.OVS, cfg_interface_str) + iface = getattr(cfg.CONF.ovs, cfg_interface_str) except (cfg.NoSuchOptError, cfg.NoSuchGroupError): pass if iface: @@ -278,13 +278,13 @@ def main(): logging_config.setup_logging(cfg.CONF) - integ_br = cfg.CONF.OVS.integration_bridge + integ_br = cfg.CONF.ovs.integration_bridge polling_interval = cfg.CONF.AGENT.polling_interval root_helper = cfg.CONF.AGENT.root_helper tunnel_ip = _get_tunnel_ip() LOG.debug(_('tunnel_ip %s'), tunnel_ip) - ovsdb_port = cfg.CONF.OVS.ovsdb_port + ovsdb_port = cfg.CONF.ovs.ovsdb_port LOG.debug(_('ovsdb_port %s'), ovsdb_port) ovsdb_ip = _get_ovsdb_ip() LOG.debug(_('ovsdb_ip %s'), ovsdb_ip) diff --git a/quantum/plugins/ryu/common/config.py b/quantum/plugins/ryu/common/config.py index fec0ead4db..e992e32a95 100644 --- a/quantum/plugins/ryu/common/config.py +++ b/quantum/plugins/ryu/common/config.py @@ -47,6 +47,6 @@ agent_opts = [ ] -cfg.CONF.register_opts(ovs_opts, "OVS") +cfg.CONF.register_opts(ovs_opts, "ovs") cfg.CONF.register_opts(agent_opts, "AGENT") config.register_root_helper(cfg.CONF) diff --git a/quantum/plugins/ryu/ryu_quantum_plugin.py b/quantum/plugins/ryu/ryu_quantum_plugin.py index 74468cfeba..3c2ac49689 100644 --- a/quantum/plugins/ryu/ryu_quantum_plugin.py +++ b/quantum/plugins/ryu/ryu_quantum_plugin.py @@ -101,8 +101,8 @@ class RyuQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2, def __init__(self, configfile=None): db.configure_db() self.tunnel_key = db_api_v2.TunnelKey( - cfg.CONF.OVS.tunnel_key_min, cfg.CONF.OVS.tunnel_key_max) - self.ofp_api_host = cfg.CONF.OVS.openflow_rest_api + cfg.CONF.ovs.tunnel_key_min, cfg.CONF.ovs.tunnel_key_max) + self.ofp_api_host = cfg.CONF.ovs.openflow_rest_api if not self.ofp_api_host: raise q_exc.Invalid(_('Invalid configuration. check ryu.ini')) diff --git a/quantum/tests/unit/cisco/test_network_plugin.py b/quantum/tests/unit/cisco/test_network_plugin.py index bab52177f5..c53e428e3c 100644 --- a/quantum/tests/unit/cisco/test_network_plugin.py +++ b/quantum/tests/unit/cisco/test_network_plugin.py @@ -96,7 +96,7 @@ class TestCiscoPortsV2(CiscoNetworkPluginV2TestCase, config = { ovs_config: { - 'OVS': {'bridge_mappings': 'physnet1:br-eth1', + 'ovs': {'bridge_mappings': 'physnet1:br-eth1', 'network_vlan_ranges': [range_str], 'tenant_network_type': 'vlan'} }, diff --git a/quantum/tests/unit/nec/test_config.py b/quantum/tests/unit/nec/test_config.py index 762ce146d6..897bcc0754 100644 --- a/quantum/tests/unit/nec/test_config.py +++ b/quantum/tests/unit/nec/test_config.py @@ -22,7 +22,7 @@ from quantum.tests import base class ConfigurationTest(base.BaseTestCase): def test_defaults(self): - self.assertEqual('br-int', config.CONF.OVS.integration_bridge) + self.assertEqual('br-int', config.CONF.ovs.integration_bridge) self.assertEqual(2, config.CONF.AGENT.polling_interval) self.assertEqual('sudo', config.CONF.AGENT.root_helper) self.assertEqual('127.0.0.1', config.CONF.OFC.host) diff --git a/quantum/tests/unit/openvswitch/test_ovs_defaults.py b/quantum/tests/unit/openvswitch/test_ovs_defaults.py index 27d996cf5f..88dcbe8942 100644 --- a/quantum/tests/unit/openvswitch/test_ovs_defaults.py +++ b/quantum/tests/unit/openvswitch/test_ovs_defaults.py @@ -22,12 +22,12 @@ from quantum.tests import base class ConfigurationTest(base.BaseTestCase): def test_defaults(self): - self.assertEqual('br-int', cfg.CONF.OVS.integration_bridge) - self.assertFalse(cfg.CONF.OVS.enable_tunneling) - self.assertEqual('br-tun', cfg.CONF.OVS.tunnel_bridge) + self.assertEqual('br-int', cfg.CONF.ovs.integration_bridge) + self.assertFalse(cfg.CONF.ovs.enable_tunneling) + self.assertEqual('br-tun', cfg.CONF.ovs.tunnel_bridge) self.assertEqual(2, cfg.CONF.AGENT.polling_interval) self.assertEqual('sudo', cfg.CONF.AGENT.root_helper) - self.assertEqual('local', cfg.CONF.OVS.tenant_network_type) - self.assertEqual(0, len(cfg.CONF.OVS.bridge_mappings)) - self.assertEqual(0, len(cfg.CONF.OVS.network_vlan_ranges)) - self.assertEqual(0, len(cfg.CONF.OVS.tunnel_id_ranges)) + self.assertEqual('local', cfg.CONF.ovs.tenant_network_type) + self.assertEqual(0, len(cfg.CONF.ovs.bridge_mappings)) + self.assertEqual(0, len(cfg.CONF.ovs.network_vlan_ranges)) + self.assertEqual(0, len(cfg.CONF.ovs.tunnel_id_ranges)) diff --git a/quantum/tests/unit/openvswitch/test_ovs_quantum_agent.py b/quantum/tests/unit/openvswitch/test_ovs_quantum_agent.py index 73bb935ee0..9b7c14f3b5 100644 --- a/quantum/tests/unit/openvswitch/test_ovs_quantum_agent.py +++ b/quantum/tests/unit/openvswitch/test_ovs_quantum_agent.py @@ -40,7 +40,7 @@ class CreateAgentConfigMap(base.BaseTestCase): def test_create_agent_config_map_fails_for_invalid_tunnel_config(self): self.addCleanup(cfg.CONF.reset) # An ip address is required for tunneling but there is no default - cfg.CONF.set_override('enable_tunneling', True, group='OVS') + cfg.CONF.set_override('enable_tunneling', True, group='ovs') with testtools.ExpectedException(ValueError): ovs_quantum_agent.create_agent_config_map(cfg.CONF) diff --git a/quantum/tests/unit/ryu/test_defaults.py b/quantum/tests/unit/ryu/test_defaults.py index 2f0e02a52e..10053710be 100644 --- a/quantum/tests/unit/ryu/test_defaults.py +++ b/quantum/tests/unit/ryu/test_defaults.py @@ -24,10 +24,10 @@ from quantum.tests import base class ConfigurationTest(base.BaseTestCase): """Configuration file Tests.""" def test_defaults(self): - self.assertEqual('br-int', cfg.CONF.OVS.integration_bridge) + self.assertEqual('br-int', cfg.CONF.ovs.integration_bridge) self.assertEqual(2, cfg.CONF.AGENT.polling_interval) self.assertEqual('sudo', cfg.CONF.AGENT.root_helper) - self.assertEqual('127.0.0.1:8080', cfg.CONF.OVS.openflow_rest_api) - self.assertEqual(1, cfg.CONF.OVS.tunnel_key_min) - self.assertEqual(0xffffff, cfg.CONF.OVS.tunnel_key_max) - self.assertEqual(6634, cfg.CONF.OVS.ovsdb_port) + self.assertEqual('127.0.0.1:8080', cfg.CONF.ovs.openflow_rest_api) + self.assertEqual(1, cfg.CONF.ovs.tunnel_key_min) + self.assertEqual(0xffffff, cfg.CONF.ovs.tunnel_key_max) + self.assertEqual(6634, cfg.CONF.ovs.ovsdb_port) diff --git a/quantum/tests/unit/ryu/test_ryu_agent.py b/quantum/tests/unit/ryu/test_ryu_agent.py index 9cc7d3538a..be7bfae907 100644 --- a/quantum/tests/unit/ryu/test_ryu_agent.py +++ b/quantum/tests/unit/ryu/test_ryu_agent.py @@ -494,7 +494,7 @@ class TestRyuQuantumAgent(RyuAgentTestCase): netifs_attrs = {'AF_INET': 0, 'ifaddresses.return_value': [[{'addr': '10.0.0.1'}]]} with nested( - mock.patch('oslo.config.cfg.CONF.OVS', **cfg_attrs), + mock.patch('oslo.config.cfg.CONF.ovs', **cfg_attrs), mock.patch(self._AGENT_NAME + '.netifaces', **netifs_attrs), mock.patch(self._AGENT_NAME + '._get_my_ip', return_value='172.16.0.1') @@ -511,7 +511,7 @@ class TestRyuQuantumAgent(RyuAgentTestCase): netifs_attrs = {'AF_INET': 0, 'ifaddresses.return_value': [[{'addr': '10.0.0.1'}]]} with nested( - mock.patch('oslo.config.cfg.CONF.OVS', **cfg_attrs), + mock.patch('oslo.config.cfg.CONF.ovs', **cfg_attrs), mock.patch(self._AGENT_NAME + '.netifaces', **netifs_attrs), mock.patch(self._AGENT_NAME + '._get_my_ip', return_value='172.16.0.1') @@ -530,7 +530,7 @@ class TestRyuQuantumAgent(RyuAgentTestCase): netifs_attrs = {'AF_INET': 0, 'ifaddresses.return_value': [[{'addr': '10.0.0.1'}]]} with nested( - mock.patch('oslo.config.cfg.CONF.OVS', **cfg_attrs), + mock.patch('oslo.config.cfg.CONF.ovs', **cfg_attrs), mock.patch(self._AGENT_NAME + '.netifaces', **netifs_attrs), mock.patch(self._AGENT_NAME + '._get_my_ip', return_value='172.16.0.1') @@ -564,8 +564,8 @@ class TestRyuQuantumAgent(RyuAgentTestCase): self.assertEqual(ip, '1.2.3.4') def mock_main(self): - cfg_attrs = {'OVS.integration_bridge': 'integ_br', - 'OVS.ovsdb_port': 16634, + cfg_attrs = {'ovs.integration_bridge': 'integ_br', + 'ovs.ovsdb_port': 16634, 'AGENT.root_helper': 'helper'} with nested( mock.patch('oslo.config.cfg.CONF', **cfg_attrs),