Centos 6.5 and up has and old version of dnsmasq

This patch updates the version of dnsmasq so dhcp-agent
can start correctly. This was found attempting to start
the testing framework with centos and neutron. This is
not triggered if the machine is anything other than
centos and 6.5 and above.

Change-Id: I622e51f8f9f912ca7bc4185614b3098208d29d11
Closes-Bug: 1397610
This commit is contained in:
JJ Asghar 2014-11-30 13:40:46 -06:00 committed by Mark Vanderwiel
parent 31f6606586
commit 4808ba56fc
5 changed files with 112 additions and 0 deletions

View File

@ -23,6 +23,7 @@ This file is used to list changes made in each version of cookbook-openstack-net
* Renamed common recipe to default
* Allow rabbit ssl in the ha case
* Fix user_group configuration in lbaas_agent.ini.erb
* Added logic for Centos 6.5 to install newer version of dnsmasq
## 10.0.1
* Add tunnel_types item in ovs_neutron_plugin.ini.erb

View File

@ -298,6 +298,11 @@ default['openstack']['network']['dhcp']['enable_isolated_metadata'] = 'False'
# This option requires enable_isolated_metadata = True
default['openstack']['network']['dhcp']['enable_metadata_network'] = 'False'
# the version of dnsmasq for centos 6.5 is two revs behind where the dhcp-agent needs
# to run properly. This is a version that allows and starts the dhcp-agent correctly.
default['openstack']['network']['dhcp']['dnsmasq_rpm_source'] = "http://pkgs.repoforge.org/dnsmasq/dnsmasq-#{node['openstack']['network']['dhcp']['dnsmasq_rpm_version']}.rpm"
default['openstack']['network']['dhcp']['dnsmasq_rpm_version'] = '2.65-1.el6.rfx.x86_64'
# On ubuntu precise, we build dnsmasq from source to fetch a more recent
# version of dnsmasq since a backport is not available. For any other
# platform, dnsmasq will be installed as a package

View File

@ -66,6 +66,25 @@ template '/etc/neutron/dhcp_agent.ini' do
notifies :restart, 'service[neutron-dhcp-agent]', :immediately
end
case node['platform']
when 'centos'
if node['platform_version'].to_f >= 6.5
dnsmasq_file = "#{Chef::Config[:file_cache_path]}/#{node['openstack']['network']['dhcp']['dnsmasq_rpm_version']}"
remote_file dnsmasq_file do
source node['openstack']['network']['dhcp']['dnsmasq_rpm_source']
not_if { ::File.exists?(dnsmasq_file) }
end
rpm_package 'dnsmasq' do
source dnsmasq_file
action :install
notifies :restart, 'service[neutron-dhcp-agent]', :immediately
end
end
end
# Deal with ubuntu precise dnsmasq 2.59 version by custom
# compiling a more recent version of dnsmasq
#

View File

@ -0,0 +1,82 @@
# Encoding: utf-8
require_relative 'spec_helper'
describe 'openstack-network::dhcp_agent' do
describe 'centos' do
let(:runner) { ChefSpec::Runner.new(CENTOS_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set['openstack']['compute']['network']['service_type'] = 'neutron'
node.set['openstack']['compute']['network']['dhcp']['dnsmasq_rpm_source'] = 'http://pkgs.repoforge.org/dnsmasq/dnsmasq-2.65-1.el6.rfx.x86_64.rpm'
runner.converge(described_recipe)
end
let(:file_cache_path) { Chef::Config[:file_cache_path] }
include_context 'neutron-stubs'
it 'does not install openstack-neutron-dhcp-agent when nova networking' do
node.override['openstack']['compute']['network']['service_type'] = 'nova'
expect(chef_run).to_not upgrade_package('neutron-dhcp-agent')
end
it 'upgrades neutron dhcp package' do
expect(chef_run).to upgrade_package('openstack-neutron')
end
it 'upgrades plugin packages' do
expect(chef_run).not_to upgrade_package(/openvswitch/)
expect(chef_run).not_to upgrade_package(/plugin/)
end
it 'starts the dhcp agent on boot' do
expect(chef_run).to enable_service('neutron-dhcp-agent')
end
it 'should have the correct dnsmasq remote file' do
expect(chef_run).to create_remote_file("#{Chef::Config[:file_cache_path]}/2.65-1.el6.rfx.x86_64").with(source: 'http://pkgs.repoforge.org/dnsmasq/dnsmasq-.rpm')
end
it 'should install the corrcet dnsmasq rpm' do
expect(chef_run).to install_rpm_package('dnsmasq').with(source: "#{Chef::Config[:file_cache_path]}/2.65-1.el6.rfx.x86_64")
end
it 'should notify dhcp agent to restart immediately' do
expect(chef_run.rpm_package('dnsmasq')).to notify('service[neutron-dhcp-agent]').to(:restart).immediately
end
describe '/etc/neutron/dhcp_agent.ini' do
let(:file) { chef_run.template('/etc/neutron/dhcp_agent.ini') }
it 'creates dhcp_agent.ini' do
expect(chef_run).to create_template(file.name).with(
user: 'neutron',
group: 'neutron',
mode: 0644
)
end
it_behaves_like 'dhcp agent template configurator' do
let(:file_name) { file.name }
end
end
describe '/etc/neutron/dnsmasq.conf' do
let(:file) { chef_run.template('/etc/neutron/dnsmasq.conf') }
it 'creates dnsmasq.conf' do
expect(chef_run).to create_template(file.name).with(
user: 'neutron',
group: 'neutron',
mode: 0644
)
end
it_behaves_like 'dnsmasq template configurator' do
let(:file_name) { file.name }
end
end
end
end

View File

@ -22,6 +22,11 @@ UBUNTU_OPTS = {
version: '12.04',
log_level: LOG_LEVEL
}
CENTOS_OPTS = {
platform: 'centos',
version: '6.5',
log_level: LOG_LEVEL
}
MOCK_NODE_NETWORK_DATA =
{