add recipe and basic configuration for metering-agent deployment
* added recipe metering_agent following the structure of the other neutron agents recipes * added minimal viable config options to default attributes * added specs Change-Id: I5f7d8b8a650497b4bcfff5f2b02b0669df656732
This commit is contained in:
parent
e7aefcd3a8
commit
79005fa659
|
@ -135,6 +135,16 @@ default['openstack']['network_metadata']['config_file'] = '/etc/neutron/metadata
|
|||
default['openstack']['network_metadata']['secret_name'] = 'neutron_metadata_secret'
|
||||
node.default['openstack']['network_metadata']['conf'] = {}
|
||||
|
||||
# ============================= Metering Agent Configuration ===============
|
||||
|
||||
default['openstack']['network_metering']['config_file'] = '/etc/neutron/metering_agent.ini'
|
||||
default['openstack']['network_metering']['conf'].tap do |conf|
|
||||
conf['DEFAULT']['interface_driver'] =
|
||||
'neutron.agent.linux.interface.OVSInterfaceDriver'
|
||||
conf['DEFAULT']['driver'] =
|
||||
'neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver'
|
||||
end
|
||||
|
||||
# ============================= VPN Agent Configuration ====================
|
||||
# vpn_device_driver_packages in platform-specific settings is used to get driver dependencies installed, default is openswan
|
||||
# vpn_device_driver_services in platform-specific settings is used to enable services required by vpn drivers, default is ipsec
|
||||
|
@ -203,6 +213,8 @@ default['openstack']['network']['platform'].tap do |platform|
|
|||
'neutron-lbaas-agent'
|
||||
platform['neutron_metadata_agent_service'] =
|
||||
'neutron-metadata-agent'
|
||||
platform['neutron_metering_agent_service'] =
|
||||
'neutron-metering-agent'
|
||||
platform['neutron_server_service'] =
|
||||
'neutron-server'
|
||||
platform['neutron_lbaas_python_dependencies'] =
|
||||
|
@ -236,6 +248,8 @@ default['openstack']['network']['platform'].tap do |platform|
|
|||
%w(neutron-plugin-linuxbridge-agent)
|
||||
platform['neutron_metadata_agent_packages'] =
|
||||
%w()
|
||||
platform['neutron_metering_agent_packages'] =
|
||||
%w(openstack-neutron-metering-agent)
|
||||
platform['neutron_server_packages'] =
|
||||
%w()
|
||||
platform['neutron_openvswitch_service'] =
|
||||
|
@ -276,6 +290,8 @@ default['openstack']['network']['platform'].tap do |platform|
|
|||
'neutron-plugin-linuxbridge-agent'
|
||||
platform['neutron_metadata_agent_packages'] =
|
||||
%w(neutron-metadata-agent)
|
||||
platform['neutron_metering_agent_packages'] =
|
||||
%w(neutron-metering-agent)
|
||||
platform['neutron_server_packages'] =
|
||||
%w(neutron-server)
|
||||
platform['neutron_openvswitch_service'] =
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
# Encoding: utf-8
|
||||
#
|
||||
# Cookbook Name:: openstack-network
|
||||
# Recipe:: metering_agent
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'openstack-network'
|
||||
|
||||
platform_options = node['openstack']['network']['platform']
|
||||
|
||||
platform_options['neutron_metering_agent_packages'].each do |pkg|
|
||||
package pkg do
|
||||
action :upgrade
|
||||
options platform_options['package_overrides']
|
||||
end
|
||||
end
|
||||
|
||||
service_config = merge_config_options 'network_metering'
|
||||
template node['openstack']['network_metering']['config_file'] do
|
||||
source 'openstack-service.conf.erb'
|
||||
cookbook 'openstack-common'
|
||||
owner node['openstack']['network']['platform']['user']
|
||||
group node['openstack']['network']['platform']['group']
|
||||
mode 00640
|
||||
variables(
|
||||
service_config: service_config
|
||||
)
|
||||
action :create
|
||||
end
|
||||
|
||||
service 'neutron-metering-agent' do
|
||||
service_name platform_options['neutron_metering_agent_service']
|
||||
supports status: true, restart: true
|
||||
action [:enable, :start]
|
||||
subscribes :restart, [
|
||||
'template[/etc/neutron/neutron.conf]',
|
||||
"template[#{node['openstack']['network_metering']['config_file']}]"
|
||||
]
|
||||
end
|
|
@ -28,7 +28,7 @@ describe 'openstack-network::lbaas' do
|
|||
)
|
||||
end
|
||||
|
||||
it 'blabla' do
|
||||
it do
|
||||
[
|
||||
/^periodic_interval = 10$/,
|
||||
/^ovs_use_veth = false$/,
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
# Encoding: utf-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-network::metering_agent' do
|
||||
describe 'ubuntu' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
|
||||
include_context 'neutron-stubs'
|
||||
|
||||
it do
|
||||
%w(neutron-metering-agent)
|
||||
.each do |pkg|
|
||||
expect(chef_run).to upgrade_package(pkg)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'metering_agent.ini' do
|
||||
let(:file) { chef_run.template('/etc/neutron/metering_agent.ini') }
|
||||
it do
|
||||
expect(chef_run).to create_template(file.name).with(
|
||||
user: 'neutron',
|
||||
group: 'neutron',
|
||||
mode: 00640
|
||||
)
|
||||
end
|
||||
|
||||
it do
|
||||
[
|
||||
/^interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver$/,
|
||||
/^driver = neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver$/
|
||||
].each do |line|
|
||||
expect(chef_run).to render_file(file.name).with_content(line)
|
||||
end
|
||||
end
|
||||
it do
|
||||
expect(chef_run).to enable_service('neutron-metering-agent')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue