From 46b71cd33ece57bea43c79bfa0d75c82d14866cd Mon Sep 17 00:00:00 2001 From: JCallicoat Date: Wed, 22 Jan 2014 21:33:41 -0600 Subject: [PATCH] add options to configure dnsmasq options in neutron. fixes #709 --- attributes/default.rb | 3 +++ recipes/neutron-dhcp-agent.rb | 12 ++++++++++++ templates/default/dhcp_agent.ini.erb | 4 ++++ templates/default/dnsmasq-neutron.conf.erb | 10 ++++++++++ 4 files changed, 29 insertions(+) create mode 100644 templates/default/dnsmasq-neutron.conf.erb diff --git a/attributes/default.rb b/attributes/default.rb index 3a6c1ba..5760281 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -88,6 +88,9 @@ default["neutron"]["isolated_metadata"] = "True" default["neutron"]["metadata_network"] = "False" default["neutron"]["dnsmasq_lease_max"] = 16777216 +default["neutron"]["dnsmasq_config_file"] = "/etc/neutron/dsnmasq-neutron.conf" +default["neutron"]["dnsmasq_dns_server"] = nil # this is a single string, not an array +default["neutron"]["dnsmasq_dhcp_script"] = nil default["neutron"]["service_neutron_metadata_proxy"] = "True" default["neutron"]["agent_down_time"] = 30 diff --git a/recipes/neutron-dhcp-agent.rb b/recipes/neutron-dhcp-agent.rb index d6f0ffe..adbeeb1 100644 --- a/recipes/neutron-dhcp-agent.rb +++ b/recipes/neutron-dhcp-agent.rb @@ -50,9 +50,21 @@ variables( "use_debug" => node["neutron"]["debug"], "dnsmasq_lease" => node["neutron"]["dnsmasq_lease_max"], + "dnsmasq_config_file" => node["neutron"]["dnsmasq_config_file"], + "dnsmasq_dns_server" => node["neutron"]["dnsmasq_dns_server"], "neutron_metadata_network" => node["neutron"]["metadata_network"], "neutron_isolated" => node["neutron"]["isolated_metadata"], "neutron_plugin" => node["neutron"]["plugin"], "neutron_dhcp_domain" => node["neutron"]["dhcp_domain"] ) end + +template node["neutron"]["dnsmasq_config_file"] do + source "dnsmasq-neutron.conf.erb" + owner "root" + group "neutron" + mode "0640" + variables( + "dhcp_script" => node["neutron"]["dnsmasq_dhcp_script"] + ) +end diff --git a/templates/default/dhcp_agent.ini.erb b/templates/default/dhcp_agent.ini.erb index 20ea30a..e888a64 100644 --- a/templates/default/dhcp_agent.ini.erb +++ b/templates/default/dhcp_agent.ini.erb @@ -23,6 +23,10 @@ enable_metadata_network = <%= @neutron_metadata_network %> ##### DNS MASQ ##### # Limit number of leases to prevent a denial-of-service. dnsmasq_lease_max = <%= @dnsmasq_lease %> +dnsmasq_config_file = <%= @dnsmasq_config_file %> +<% unless @dnsmasq_dns_server.nil? %> +dnsmasq_dns_server = <%= @dnsmasq_dns_server %> +<% end %> <% if @neutron_plugin == "ovs" %> diff --git a/templates/default/dnsmasq-neutron.conf.erb b/templates/default/dnsmasq-neutron.conf.erb new file mode 100644 index 0000000..b170221 --- /dev/null +++ b/templates/default/dnsmasq-neutron.conf.erb @@ -0,0 +1,10 @@ +# This file autogenerated by Chef +# Do not edit, changes will be overwritten + +# make default MTU smaller to allow for overhead of OVS tags +# https://github.com/rcbops/chef-cookbooks/issues/709 +dhcp-option=26,1454 + +<% unless @dhcp_script.nil? %> +dhcp-script=@dhcp_script +<% end %>