Unhardcode more options for dhcp agent
Change-Id: I4e0ff6f5a77a012d5e2bd5d52a24e3574bf98df9
diff --git a/README.rst b/README.rst
index 4d3e86a..4c4bb32 100644
--- a/README.rst
+++ b/README.rst
@@ -211,7 +211,6 @@
version: mitaka
dhcp_lease_duration: 600
firewall_driver: iptables_hybrid
- ovs_use_veth: False
message_queue:
engine: rabbitmq
host: 127.0.0.1
@@ -231,6 +230,9 @@
mechanism:
ovs:
driver: openvswitch
+ agents:
+ dhcp:
+ ovs_use_veth: False
Compute Node
diff --git a/neutron/files/pike/dhcp_agent.ini b/neutron/files/pike/dhcp_agent.ini
index 437d3d1..cbc5b2a 100644
--- a/neutron/files/pike/dhcp_agent.ini
+++ b/neutron/files/pike/dhcp_agent.ini
@@ -11,12 +11,15 @@
# Name of Open vSwitch bridge to use (string value)
#ovs_integration_bridge = br-int
+{%- if neutron.get('agents', {}).get('dhcp', {}).ovs_integration_bridge is defined %}
+ovs_integration_bridge = {{ neutron.agents.dhcp.ovs_integration_bridge }}
+{%- endif %}
# Uses veth for an OVS interface or not. Support kernels with limited namespace support (e.g. RHEL 6.5) so long as ovs_use_veth is set to
# True. (boolean value)
#ovs_use_veth = false
-{%- if neutron.ovs_use_veth is defined %}
-ovs_use_veth = {{ neutron.ovs_use_veth }}
+{%- if neutron.get('agents', {}).get('dhcp', {}).ovs_use_veth is defined %}
+ovs_use_veth = {{ neutron.agents.dhcp.ovs_use_veth }}
{%- endif %}
# MTU setting for device. This option will be removed in Newton. Please use the system-wide global_physnet_mtu setting which the agents will
@@ -27,11 +30,16 @@
# The driver used to manage the virtual interface. (string value)
#interface_driver = <None>
+{%- if neutron.get('agents', {}).get('dhcp', {}).interface_driver is defined %}
+interface_driver = {{ neutron.agents.dhcp.interface_driver }}
+{%- else %}
interface_driver = openvswitch
+{%- endif %}
# Timeout in seconds for ovs-vsctl commands. If the timeout expires, ovs commands will fail with ALARMCLOCK error. (integer value)
#ovs_vsctl_timeout = 10
+
#
# From neutron.dhcp.agent
#
@@ -39,24 +47,36 @@
# The DHCP agent will resync its state with Neutron to recover from any transient notification or RPC errors. The interval is number of
# seconds between attempts. (integer value)
#resync_interval = 5
+{%- if neutron.get('agents', {}).get('dhcp', {}).resync_interval is defined %}
+resync_interval = {{ neutron.agents.dhcp.resync_interval }}
+{%- else %}
resync_interval = 30
+{%- endif %}
# The driver used to manage the DHCP server. (string value)
#dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
-dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
+{%- if neutron.get('agents', {}).get('dhcp', {}).dhcp_driver is defined %}
+dhcp_driver = {{ neutron.agents.dhcp.dhcp_driver }}
+{%- endif %}
# The DHCP server can assist with providing metadata support on isolated networks. Setting this value to True will cause the DHCP server to
# append specific host routes to the DHCP request. The metadata service will only be activated when the subnet does not contain any router
# port. The guest instance must be configured to request host routes via DHCP (Option 121). This option doesn't have any effect when
# force_metadata is set to True. (boolean value)
#enable_isolated_metadata = false
+{%- if neutron.get('agents', {}).get('dhcp', {}).enable_isolated_metadata is defined %}
+enable_isolated_metadata = {{ neutron.agents.dhcp.enable_isolated_metadata }}
+{%- else %}
enable_isolated_metadata = True
+{%- endif %}
# In some cases the Neutron router is not present to provide the metadata IP but the DHCP server can be used to provide this info. Setting
# this value will force the DHCP server to append specific host routes to the DHCP request. If this option is set, then the metadata service
# will be activated for all the networks. (boolean value)
#force_metadata = false
-{%- if neutron.backend.router is defined or neutron.force_metadata|default(False) %}
+{%- if neutron.get('agents', {}).get('dhcp', {}).force_metadata is defined %}
+force_metadata = {{ neutron.agents.dhcp.force_metadata }}
+{%- elif neutron.backend.router is defined %}
force_metadata = True
{%- endif %}
@@ -64,13 +84,23 @@
# and is connected to a Neutron router from which the VMs send metadata:1 request. In this case DHCP Option 121 will not be injected in VMs,
# as they will be able to reach 169.254.169.254 through a router. This option requires enable_isolated_metadata = True. (boolean value)
#enable_metadata_network = false
+{%- if neutron.get('agents', {}).get('dhcp', {}).enable_metadata_network is defined %}
+enable_metadata_network = {{ neutron.agents.dhcp.enable_metadata_network }}
+{%- else %}
enable_metadata_network = False
+{%- endif %}
# Number of threads to use during sync process. Should not exceed connection pool size configured on server. (integer value)
#num_sync_threads = 4
+{%- if neutron.get('agents', {}).get('dhcp', {}).num_sync_threads is defined %}
+num_sync_threads = {{ neutron.agents.dhcp.num_sync_threads }}
+{%- endif %}
# Location to store DHCP server config files. (string value)
#dhcp_confs = $state_path/dhcp
+{%- if neutron.get('agents', {}).get('dhcp', {}).dnsmasq_config_file is defined %}
+dnsmasq_config_file = {{ neutron.agents.dhcp.dnsmasq_config_file }}
+{%- endif %}
# Domain to use for building the hostnames. This option is deprecated. It has been moved to neutron.conf as dns_domain. It will be removed
# in a future release. (string value)
diff --git a/neutron/files/queens/dhcp_agent.ini b/neutron/files/queens/dhcp_agent.ini
index b16e956..1c0ff9a 100644
--- a/neutron/files/queens/dhcp_agent.ini
+++ b/neutron/files/queens/dhcp_agent.ini
@@ -11,18 +11,25 @@
# Name of Open vSwitch bridge to use (string value)
#ovs_integration_bridge = br-int
+{%- if neutron.get('agents', {}).get('dhcp', {}).ovs_integration_bridge is defined %}
+ovs_integration_bridge = {{ neutron.agents.dhcp.ovs_integration_bridge }}
+{%- endif %}
# Uses veth for an OVS interface or not. Support kernels with limited namespace
# support (e.g. RHEL 6.5) and rate limiting on router's gateway port so long as
# ovs_use_veth is set to True. (boolean value)
#ovs_use_veth = false
-{%- if neutron.ovs_use_veth is defined %}
-ovs_use_veth = {{ neutron.ovs_use_veth }}
+{%- if neutron.get('agents', {}).get('dhcp', {}).ovs_use_veth is defined %}
+ovs_use_veth = {{ neutron.agents.dhcp.ovs_use_veth }}
{%- endif %}
# The driver used to manage the virtual interface. (string value)
#interface_driver = <None>
+{%- if neutron.get('agents', {}).get('dhcp', {}).interface_driver is defined %}
+interface_driver = {{ neutron.agents.dhcp.interface_driver }}
+{%- else %}
interface_driver = openvswitch
+{%- endif %}
#
# From neutron.dhcp.agent
@@ -32,11 +39,17 @@
# transient notification or RPC errors. The interval is number of seconds
# between attempts. (integer value)
#resync_interval = 5
+{%- if neutron.get('agents', {}).get('dhcp', {}).resync_interval is defined %}
+resync_interval = {{ neutron.agents.dhcp.resync_interval }}
+{%- else %}
resync_interval = 30
+{%- endif %}
# The driver used to manage the DHCP server. (string value)
#dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
-dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
+{%- if neutron.get('agents', {}).get('dhcp', {}).dhcp_driver is defined %}
+dhcp_driver = {{ neutron.agents.dhcp.dhcp_driver }}
+{%- endif %}
# The DHCP server can assist with providing metadata support on isolated
# networks. Setting this value to True will cause the DHCP server to append
@@ -46,7 +59,11 @@
# This option doesn't have any effect when force_metadata is set to True.
# (boolean value)
#enable_isolated_metadata = false
+{%- if neutron.get('agents', {}).get('dhcp', {}).enable_isolated_metadata is defined %}
+enable_isolated_metadata = {{ neutron.agents.dhcp.enable_isolated_metadata }}
+{%- else %}
enable_isolated_metadata = True
+{%- endif %}
# In some cases the Neutron router is not present to provide the metadata IP
# but the DHCP server can be used to provide this info. Setting this value will
@@ -54,7 +71,9 @@
# this option is set, then the metadata service will be activated for all the
# networks. (boolean value)
#force_metadata = false
-{%- if neutron.backend.router is defined or neutron.force_metadata|default(False) %}
+{%- if neutron.get('agents', {}).get('dhcp', {}).force_metadata is defined %}
+force_metadata = {{ neutron.agents.dhcp.force_metadata }}
+{%- elif neutron.backend.router is defined %}
force_metadata = True
{%- endif %}
@@ -65,17 +84,30 @@
# 169.254.169.254 through a router. This option requires
# enable_isolated_metadata = True. (boolean value)
#enable_metadata_network = false
+{%- if neutron.get('agents', {}).get('dhcp', {}).enable_metadata_network is defined %}
+enable_metadata_network = {{ neutron.agents.dhcp.enable_metadata_network }}
+{%- else %}
enable_metadata_network = False
+{%- endif %}
# Number of threads to use during sync process. Should not exceed connection
# pool size configured on server. (integer value)
#num_sync_threads = 4
+{%- if neutron.get('agents', {}).get('dhcp', {}).num_sync_threads is defined %}
+num_sync_threads = {{ neutron.agents.dhcp.num_sync_threads }}
+{%- endif %}
# Location to store DHCP server config files. (string value)
#dhcp_confs = $state_path/dhcp
+{%- if neutron.get('agents', {}).get('dhcp', {}).dhcp_confs is defined %}
+dhcp_confs = {{ neutron.agents.dhcp.dhcp_confs }}
+{%- endif %}
# Override the default dnsmasq settings with this file. (string value)
#dnsmasq_config_file =
+{%- if neutron.get('agents', {}).get('dhcp', {}).dnsmasq_config_file is defined %}
+dnsmasq_config_file = {{ neutron.agents.dhcp.dnsmasq_config_file }}
+{%- endif %}
# Comma-separated list of the DNS servers which will be used as forwarders.
# (list value)
@@ -85,6 +117,9 @@
# information and is useful for debugging issues with either DHCP or DNS. If
# this section is null, disable dnsmasq log. (string value)
#dnsmasq_base_log_dir = <None>
+{%- if neutron.get('agents', {}).get('dhcp', {}).dnsmasq_base_log_dir is defined %}
+dnsmasq_base_log_dir = {{ neutron.agents.dhcp.dnsmasq_base_log_dir }}
+{%- endif %}
# Enables the dnsmasq service to provide name resolution for instances via DNS
# resolvers on the host running the DHCP agent. Effectively removes the '--no-
@@ -92,12 +127,21 @@
# resolvers to the 'dnsmasq_dns_servers' option disables this feature. (boolean
# value)
#dnsmasq_local_resolv = false
+{%- if neutron.get('agents', {}).get('dhcp', {}).dnsmasq_local_resolv is defined %}
+dnsmasq_local_resolv = {{ neutron.agents.dhcp.dnsmasq_local_resolv }}
+{%- endif %}
# Limit number of leases to prevent a denial-of-service. (integer value)
#dnsmasq_lease_max = 16777216
+{%- if neutron.get('agents', {}).get('dhcp', {}).dnsmasq_lease_max is defined %}
+dnsmasq_lease_max = {{ neutron.agents.dhcp.dnsmasq_lease_max }}
+{%- endif %}
# Use broadcast in DHCP replies. (boolean value)
#dhcp_broadcast_reply = false
+{%- if neutron.get('agents', {}).get('dhcp', {}).dhcp_broadcast_reply is defined %}
+dhcp_broadcast_reply = {{ neutron.agents.dhcp.dhcp_broadcast_reply }}
+{%- endif %}
{%- if neutron.logging is defined %}
{%- set _data = neutron.logging %}
@@ -112,6 +156,9 @@
# Availability zone of this node (string value)
#availability_zone = nova
+{%- if neutron.get('agents', {}).get('dhcp', {}).get('agent', {}).availability_zone is defined %}
+availability_zone = {{ neutron.agents.dhcp.agent.availability_zone }}
+{%- endif %}
#
# From neutron.base.agent
@@ -121,9 +168,15 @@
# agent_down_time, best if it is half or less than agent_down_time. (floating
# point value)
#report_interval = 30
+{%- if neutron.get('agents', {}).get('dhcp', {}).get('agent', {}).report_interval is defined %}
+report_interval = {{ neutron.agents.dhcp.agent.report_interval }}
+{%- endif %}
# Log agent heartbeats (boolean value)
#log_agent_heartbeats = false
+{%- if neutron.get('agents', {}).get('dhcp', {}).get('agent', {}).log_agent_heartbeats is defined %}
+log_agent_heartbeats = {{ neutron.agents.dhcp.agent.log_agent_heartbeats }}
+{%- endif %}
[ovs]
diff --git a/tests/pillar/gateway_legacy.sls b/tests/pillar/gateway_legacy.sls
index c2606f3..5776d69 100644
--- a/tests/pillar/gateway_legacy.sls
+++ b/tests/pillar/gateway_legacy.sls
@@ -3,7 +3,6 @@
agent_mode: legacy
dhcp_lease_duration: 86400
firewall_driver: noop
- ovs_use_veth: True
backend:
engine: ml2
tenant_network_types: "flat,vxlan"
@@ -26,3 +25,6 @@
password: password
workers: 2
version: mitaka
+ agents:
+ dhcp:
+ ovs_use_veth: True