CentOS 8 support

- Update various packages for EL8
- Use platform family for installing dnsmasq
- ChefSpec updates

Depends-On: https://review.opendev.org/c/openstack/cookbook-openstack-identity/+/815147
Change-Id: Ia566d70348f1245733b5074b3ad6e0bb30c3e405
Signed-off-by: Lance Albertson <lance@osuosl.org>
This commit is contained in:
Lance Albertson 2021-10-22 13:43:59 -07:00
parent f687f40c16
commit 75e073a7b0
11 changed files with 219 additions and 194 deletions

View File

@ -142,7 +142,7 @@ default['openstack']['network']['platform'].tap do |platform|
platform['neutron_server_service'] = 'neutron-server'
platform['neutron_rpc_server_service'] = 'neutron-rpc-server'
case node['platform_family']
when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
when 'rhel'
platform['neutron_packages'] =
%w(
ebtables

View File

@ -50,11 +50,9 @@ end
# TODO: (jklare) this should be refactored and probably pull in the some dnsmasq
# cookbook to do the proper configuration
if platform?('centos')
rpm_package 'dnsmasq' do
action :upgrade
end
end
package 'dnsmasq' do
action :upgrade
end if platform_family?('rhel')
service 'neutron-dhcp-agent' do
service_name platform_options['neutron_dhcp_agent_service']
@ -64,6 +62,6 @@ service 'neutron-dhcp-agent' do
'template[/etc/neutron/neutron.conf]',
'template[/etc/neutron/dnsmasq.conf]',
"template[#{node['openstack']['network_dhcp']['config_file']}]",
'rpm_package[dnsmasq]',
'package[dnsmasq]',
]
end

View File

@ -1,35 +1,44 @@
require_relative 'spec_helper'
describe 'openstack-network' do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge(described_recipe)
end
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
include_context 'neutron-stubs'
pkgs =
%w(
ebtables
iproute
openstack-neutron
openstack-neutron-ml2
)
it do
expect(chef_run).to upgrade_package(pkgs)
end
it do
expect(chef_run).to upgrade_package('MySQL-python')
end
it do
expect(chef_run).to create_cookbook_file('/usr/bin/neutron-enable-bridge-firewall.sh').with(
source: 'neutron-enable-bridge-firewall.sh',
owner: 'root',
group: 'wheel',
mode: '0755'
)
pkgs =
%w(
ebtables
iproute
openstack-neutron
openstack-neutron-ml2
)
it do
expect(chef_run).to upgrade_package(pkgs)
end
case p
when REDHAT_7
it do
expect(chef_run).to upgrade_package('MySQL-python')
end
when REDHAT_8
it do
expect(chef_run).to upgrade_package('python3-PyMySQL')
end
end
it do
expect(chef_run).to create_cookbook_file('/usr/bin/neutron-enable-bridge-firewall.sh').with(
source: 'neutron-enable-bridge-firewall.sh',
owner: 'root',
group: 'wheel',
mode: '0755'
)
end
end
end
end

View File

@ -1,24 +1,26 @@
require_relative 'spec_helper'
describe 'openstack-network::dhcp_agent' do
describe 'centos' do
let(:runner) { ChefSpec::SoloRunner.new(CENTOS_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
runner.converge(described_recipe)
end
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
runner.converge(described_recipe)
end
let(:file_cache_path) { Chef::Config[:file_cache_path] }
let(:file_cache_path) { Chef::Config[:file_cache_path] }
include_context 'neutron-stubs'
include_context 'neutron-stubs'
it do
expect(chef_run).to upgrade_package(%w(openstack-neutron iproute))
end
it do
expect(chef_run).to upgrade_package(%w(openstack-neutron iproute))
end
it do
expect(chef_run).to upgrade_rpm_package('dnsmasq')
it do
expect(chef_run).to upgrade_package('dnsmasq')
end
end
end
end

View File

@ -1,26 +1,28 @@
require_relative 'spec_helper'
describe 'openstack-network::l3_agent' do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
stub_command('ovs-vsctl br-exists br-ex').and_return(false)
runner.converge(described_recipe)
end
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
stub_command('ovs-vsctl br-exists br-ex').and_return(false)
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
include_context 'neutron-stubs'
pkgs =
%w(
iproute
keepalived
openstack-neutron
radvd
)
it do
expect(chef_run).to upgrade_package(pkgs)
pkgs =
%w(
iproute
keepalived
openstack-neutron
radvd
)
it do
expect(chef_run).to upgrade_package(pkgs)
end
end
end
end

View File

@ -1,28 +1,30 @@
require_relative 'spec_helper'
describe 'openstack-network::metadata_agent' do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
runner.converge(described_recipe)
end
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
include_context 'neutron-stubs'
it do
expect(chef_run).to enable_service('neutron-metadata-agent').with(
service_name: 'neutron-metadata-agent',
supports: {
status: true,
restart: true,
}
)
end
it do
expect(chef_run).to enable_service('neutron-metadata-agent').with(
service_name: 'neutron-metadata-agent',
supports: {
status: true,
restart: true,
}
)
end
it do
expect(chef_run).to start_service('neutron-metadata-agent')
it do
expect(chef_run).to start_service('neutron-metadata-agent')
end
end
end
end

View File

@ -1,57 +1,54 @@
# pkg upgrade
# service
# Encoding: utf-8
require_relative 'spec_helper'
describe 'openstack-network::ml2_linuxbridge' do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['network']['plugins']['linuxbridge']['path'] = '/etc/neutron/plugins/ml2'
node.override['openstack']['network']['plugins']['linuxbridge']['filename'] = 'linuxbridge_agent.ini'
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
it 'creates the /etc/neutron/plugins/ml2 agent directory' do
expect(chef_run).to create_directory('/etc/neutron/plugins/ml2').with(
owner: 'neutron',
group: 'neutron',
mode: '700'
)
end
it do
expect(chef_run).to include_recipe('openstack-network::plugin_config')
end
describe '/etc/neutron/plugins/ml2/linuxbridge_agent.ini' do
let(:file) do
chef_run.template('/etc/neutron/plugins/ml2/linuxbridge_agent.ini')
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['network']['plugins']['linuxbridge']['path'] = '/etc/neutron/plugins/ml2'
node.override['openstack']['network']['plugins']['linuxbridge']['filename'] = 'linuxbridge_agent.ini'
runner.converge(described_recipe)
end
[
/^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/,
].each do |line|
it do
expect(chef_run).to render_config_file(file.name)
.with_section_content('securitygroup', line)
include_context 'neutron-stubs'
it 'creates the /etc/neutron/plugins/ml2 agent directory' do
expect(chef_run).to create_directory('/etc/neutron/plugins/ml2').with(
owner: 'neutron',
group: 'neutron',
mode: '700'
)
end
it do
expect(chef_run).to include_recipe('openstack-network::plugin_config')
end
describe '/etc/neutron/plugins/ml2/linuxbridge_agent.ini' do
let(:file) do
chef_run.template('/etc/neutron/plugins/ml2/linuxbridge_agent.ini')
end
[
/^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/,
].each do |line|
it do
expect(chef_run).to render_config_file(file.name)
.with_section_content('securitygroup', line)
end
end
end
end
it do
expect(chef_run).to upgrade_package(%w(openstack-neutron-linuxbridge iproute))
end
it do
expect(chef_run).to upgrade_package(%w(openstack-neutron-linuxbridge iproute))
end
it do
expect(chef_run).to enable_service('neutron-linuxbridge-agent')
end
it do
service = chef_run.service('neutron-linuxbridge-agent')
expect(service).to(subscribe_to('template[/etc/neutron/neutron.conf]').on(:restart).delayed) && subscribe_to('template[/etc/neutron/plugins/ml2/linuxbridge_agent.ini]').on(:restart).delayed
it do
expect(chef_run).to enable_service('neutron-linuxbridge-agent')
end
it do
service = chef_run.service('neutron-linuxbridge-agent')
expect(service).to(subscribe_to('template[/etc/neutron/neutron.conf]').on(:restart).delayed) && subscribe_to('template[/etc/neutron/plugins/ml2/linuxbridge_agent.ini]').on(:restart).delayed
end
end
end
end

View File

@ -1,25 +1,29 @@
require_relative 'spec_helper'
describe 'openstack-network::openvswitch' do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge(described_recipe)
end
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge(described_recipe)
end
it do
expect(chef_run).to upgrade_package 'openvswitch'
end
it do
expect(chef_run).to upgrade_package 'openvswitch'
end
it do
expect(chef_run).to enable_service('neutron-openvswitch-switch').with(
service_name: 'openvswitch',
supports: {
status: true,
restart: true,
}
)
it do
expect(chef_run).to enable_service('neutron-openvswitch-switch').with(
service_name: 'openvswitch',
supports: {
status: true,
restart: true,
}
)
end
end
end
end
end

View File

@ -1,32 +1,34 @@
require_relative 'spec_helper'
describe 'openstack-network::openvswitch_agent' do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['network']['openvswitch']['integration_bridge'] = 'br-int'
runner.converge(described_recipe)
end
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['network']['openvswitch']['integration_bridge'] = 'br-int'
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
include_context 'neutron-stubs'
before do
stub_command('ovs-vsctl --may-exist add-br br-int')
end
before do
stub_command('ovs-vsctl --may-exist add-br br-int')
end
it do
expect(chef_run).to upgrade_package %w(openstack-neutron-openvswitch iproute)
end
it do
expect(chef_run).to upgrade_package %w(openstack-neutron-openvswitch iproute)
end
it do
expect(chef_run).to enable_service('neutron-openvswitch-agent').with(
service_name: 'neutron-openvswitch-agent',
supports: {
status: true,
restart: true,
}
)
it do
expect(chef_run).to enable_service('neutron-openvswitch-agent').with(
service_name: 'neutron-openvswitch-agent',
supports: {
status: true,
restart: true,
}
)
end
end
end
end

View File

@ -1,28 +1,30 @@
require_relative 'spec_helper'
describe 'openstack-network::server' do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
node.override['openstack']['network']['plugins']['ml2']['path'] = '/etc/neutron/plugins/ml2'
node.override['openstack']['network']['plugins']['ml2']['filename'] = 'openvswitch_agent.ini'
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
node.override['openstack']['network']['plugins']['ml2']['path'] = '/etc/neutron/plugins/ml2'
node.override['openstack']['network']['plugins']['ml2']['filename'] = 'openvswitch_agent.ini'
runner.converge(described_recipe)
end
include_context 'neutron-stubs'
it do
expect(chef_run).to upgrade_package %w(ebtables iproute openstack-neutron openstack-neutron-ml2)
end
it do
expect(chef_run).to upgrade_package %w(ebtables iproute openstack-neutron openstack-neutron-ml2)
end
it do
expect(chef_run).to enable_service 'neutron-server'
end
it do
expect(chef_run).to enable_service 'neutron-server'
end
it 'does not upgrade openvswitch package' do
expect(chef_run).not_to upgrade_package 'openvswitch'
expect(chef_run).not_to enable_service 'neutron-openvswitch-agent'
it 'does not upgrade openvswitch package' do
expect(chef_run).not_to upgrade_package 'openvswitch'
expect(chef_run).not_to enable_service 'neutron-openvswitch-agent'
end
end
end
end

View File

@ -9,18 +9,25 @@ RSpec.configure do |config|
config.log_level = :warn
end
REDHAT_OPTS = {
REDHAT_7 = {
platform: 'redhat',
version: '7',
}.freeze
REDHAT_8 = {
platform: 'redhat',
version: '8',
}.freeze
ALL_RHEL = [
REDHAT_7,
REDHAT_8,
].freeze
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '18.04',
}.freeze
CENTOS_OPTS = {
platform: 'centos',
version: '7',
}.freeze
shared_context 'neutron-stubs' do
before do