From da4744543bc716e20ba9f8178c464c46a1c4db17 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Wed, 20 Jan 2016 13:59:54 +0000 Subject: [PATCH 1/3] Added config option 'dhcp-agents-per-network' with a default value of 2. It is only activitated when the 'enable-l3ha' option is True. --- config.yaml | 9 ++++++++- hooks/neutron_api_context.py | 1 + templates/icehouse/neutron.conf | 4 +++- templates/juno/neutron.conf | 2 ++ templates/kilo/neutron.conf | 2 ++ templates/liberty/neutron.conf | 2 ++ unit_tests/test_neutron_api_context.py | 2 ++ 7 files changed, 20 insertions(+), 2 deletions(-) diff --git a/config.yaml b/config.yaml index f58b519e..0b1978d6 100755 --- a/config.yaml +++ b/config.yaml @@ -185,7 +185,7 @@ options: type: int description: | Number of routers allowed per tenant. A negative value means unlimited. - quota-floatingip: + quota-floatingip: default: 50 type: int description: | @@ -398,6 +398,13 @@ options: description: | Minimum number of l3 agents to host a router. Only used when enable-l3ha is True + dhcp-agents-per-network: + default: 2 + type: int + description: | + The number of dhcp agents to be deployed per network. This option is + only used if the 'enable-l3ha' option is True. Note that if the Calico + plugin is being used, this option has no effect. nagios_servicegroups: default: "" type: string diff --git a/hooks/neutron_api_context.py b/hooks/neutron_api_context.py index 96dbe6eb..441caa4b 100644 --- a/hooks/neutron_api_context.py +++ b/hooks/neutron_api_context.py @@ -174,6 +174,7 @@ class NeutronCCContext(context.NeutronContext): config('max-l3-agents-per-router') ctxt['min_l3_agents_per_router'] = \ config('min-l3-agents-per-router') + ctxt['dhcp_agents_per_network'] = config('dhcp-agents-per-network') ctxt['overlay_network_type'] = self.neutron_overlay_network_type ctxt['external_network'] = config('neutron-external-network') if config('neutron-plugin') in ['vsp']: diff --git a/templates/icehouse/neutron.conf b/templates/icehouse/neutron.conf index 4ef069c7..a0756a34 100644 --- a/templates/icehouse/neutron.conf +++ b/templates/icehouse/neutron.conf @@ -47,6 +47,8 @@ neutron_firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptable {% if neutron_plugin == 'Calico' -%} dhcp_agents_per_network = 1000 +{% else -%} +dhcp_agents_per_network = {{ dhcp_agents_per_network }} {% endif -%} {% include "parts/rabbitmq" %} @@ -82,7 +84,7 @@ quota_security_group_rule = {{ quota_security_group_rule }} quota_items = network,subnet,port {% endif -%} quota_network = {{ quota_network }} -quota_subnet = {{ quota_subnet }} +quota_subnet = {{ quota_subnet }} quota_port = {{ quota_port }} quota_vip = {{ quota_vip }} quota_pool = {{ quota_pool }} diff --git a/templates/juno/neutron.conf b/templates/juno/neutron.conf index d5ed593d..2e91e1af 100644 --- a/templates/juno/neutron.conf +++ b/templates/juno/neutron.conf @@ -47,6 +47,8 @@ neutron_firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptable {% if neutron_plugin == 'Calico' -%} dhcp_agents_per_network = 1000 +{% else -%} +dhcp_agents_per_network = {{ dhcp_agents_per_network }} {% endif -%} {% include "parts/rabbitmq" %} diff --git a/templates/kilo/neutron.conf b/templates/kilo/neutron.conf index b03b3e0f..6c56c153 100644 --- a/templates/kilo/neutron.conf +++ b/templates/kilo/neutron.conf @@ -51,6 +51,8 @@ neutron_firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptable {% if neutron_plugin == 'Calico' -%} dhcp_agents_per_network = 1000 +{% else -%} +dhcp_agents_per_network = {{ dhcp_agents_per_network }} {% endif -%} notify_nova_on_port_status_changes = True diff --git a/templates/liberty/neutron.conf b/templates/liberty/neutron.conf index 4a15e5f9..2f5d6997 100644 --- a/templates/liberty/neutron.conf +++ b/templates/liberty/neutron.conf @@ -51,6 +51,8 @@ neutron_firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptable {% if neutron_plugin == 'Calico' -%} dhcp_agents_per_network = 1000 +{% else -%} +dhcp_agents_per_network = {{ dhcp_agents_per_network }} {% endif -%} notify_nova_on_port_status_changes = True diff --git a/unit_tests/test_neutron_api_context.py b/unit_tests/test_neutron_api_context.py index c5b5acff..b949b614 100644 --- a/unit_tests/test_neutron_api_context.py +++ b/unit_tests/test_neutron_api_context.py @@ -284,6 +284,7 @@ class NeutronCCContextTest(CharmTestCase): self.test_config.set('plumgrid-password', 'plumgrid') self.test_config.set('plumgrid-virtual-ip', '192.168.100.250') self.test_config.set('enable-ml2-port-security', True) + self.test_config.set('dhcp-agents-per-network', 3) def tearDown(self): super(NeutronCCContextTest, self).tearDown() @@ -376,6 +377,7 @@ class NeutronCCContextTest(CharmTestCase): 'overlay_network_type': 'gre', 'max_l3_agents_per_router': 2, 'min_l3_agents_per_router': 2, + 'dhcp_agents_per_network': 3, 'quota_floatingip': 50, 'quota_health_monitors': -1, 'quota_member': -1, From b17bf9ed8d52ac285a67d58635cb652cea82e22b Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Wed, 20 Jan 2016 16:38:56 +0000 Subject: [PATCH 2/3] Change to the dhcp-agents-per-network setting such that it is always active and not just when enable-l3ha is true. This is to provide non-ha environments with the option to have multiple dhcp agents (which are controlled directly by neutron). The default, is therefore, 1. --- config.yaml | 2 +- hooks/neutron_api_context.py | 2 +- unit_tests/test_neutron_api_context.py | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config.yaml b/config.yaml index 0b1978d6..7d424981 100755 --- a/config.yaml +++ b/config.yaml @@ -399,7 +399,7 @@ options: Minimum number of l3 agents to host a router. Only used when enable-l3ha is True dhcp-agents-per-network: - default: 2 + default: 1 type: int description: | The number of dhcp agents to be deployed per network. This option is diff --git a/hooks/neutron_api_context.py b/hooks/neutron_api_context.py index 441caa4b..5af5aa26 100644 --- a/hooks/neutron_api_context.py +++ b/hooks/neutron_api_context.py @@ -174,7 +174,7 @@ class NeutronCCContext(context.NeutronContext): config('max-l3-agents-per-router') ctxt['min_l3_agents_per_router'] = \ config('min-l3-agents-per-router') - ctxt['dhcp_agents_per_network'] = config('dhcp-agents-per-network') + ctxt['dhcp_agents_per_network'] = config('dhcp-agents-per-network') ctxt['overlay_network_type'] = self.neutron_overlay_network_type ctxt['external_network'] = config('neutron-external-network') if config('neutron-plugin') in ['vsp']: diff --git a/unit_tests/test_neutron_api_context.py b/unit_tests/test_neutron_api_context.py index b949b614..ea414f67 100644 --- a/unit_tests/test_neutron_api_context.py +++ b/unit_tests/test_neutron_api_context.py @@ -298,6 +298,7 @@ class NeutronCCContextTest(CharmTestCase): 'debug': True, 'enable_dvr': False, 'l3_ha': False, + 'dhcp_agents_per_network': 3, 'external_network': 'bob', 'neutron_bind_port': self.api_port, 'verbose': True, @@ -332,6 +333,7 @@ class NeutronCCContextTest(CharmTestCase): 'debug': True, 'enable_dvr': False, 'l3_ha': False, + 'dhcp_agents_per_network': 3, 'external_network': 'bob', 'neutron_bind_port': self.api_port, 'verbose': True, From 4151d872e3d5db834bd02d0a2beaf7f1d97e1754 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Thu, 21 Jan 2016 09:37:09 +0000 Subject: [PATCH 3/3] Change comment for dhcp-agents-per-network option to reflect that it is independent of the 'enable-l3ha' option. --- config.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config.yaml b/config.yaml index 7d424981..d2f0b4b0 100755 --- a/config.yaml +++ b/config.yaml @@ -402,9 +402,8 @@ options: default: 1 type: int description: | - The number of dhcp agents to be deployed per network. This option is - only used if the 'enable-l3ha' option is True. Note that if the Calico - plugin is being used, this option has no effect. + The number of dhcp agents to be deployed per network. Note that if the + Calico plugin is being used, this option has no effect. nagios_servicegroups: default: "" type: string