Restart neutron services on neutron config change
There are many neutron tasks, e.g.: common-config and network-plugins-l2.
Normally the common-config configures neutron.conf and then plugns-l2 starts
the ovs-agent.
But there is the wrong behaviour when new controllers are added to an
environment:
1. configure and deploy an env.
2. common-config configures neutron.conf
3. plugins-l2 starts ovs-agent.
4. add new controllers to the env and redeploy it.
5. common-config configures neutron.conf.
6. plugins-l2 knows nothing about changes in the config.
So ovs-agent isn't restarted and works with old configuration data.
This commit makes neutron tasks check md5 hash of neutron.conf and
restart them when config is changed.
(cherry-picked from 5912ee7ea5
)
Change-Id: Ia26f4a5105407ce322a5185455093d69a938edfc
Closes-bug: #1613724
This commit is contained in:
parent
c5ebaafa6a
commit
0ecf4ef328
|
@ -142,8 +142,8 @@
|
|||
$.get('use_ssl'), $.get('region'), $.network_scheme, $.network_metadata,
|
||||
$.neutron_advanced_configuration, $.get('security_groups'),
|
||||
$.network_metadata.nodes.values().where(
|
||||
$.node_roles.any($.matches('(controller|rabbitmq)'))).network_roles.select(
|
||||
$.get('mgmt/messaging')))
|
||||
$.node_roles.any($.matches('controller|rabbitmq'))).network_roles.select($.get('mgmt/messaging')),
|
||||
$.get('amqp_hosts'))
|
||||
refresh_on: [neutron_agent_ovs]
|
||||
parameters:
|
||||
puppet_manifest: /etc/puppet/modules/openstack_tasks/examples/openstack-network/plugins/ml2.pp
|
||||
|
|
|
@ -36,4 +36,8 @@ class openstack_tasks::openstack_network::agents::dhcp {
|
|||
|
||||
}
|
||||
|
||||
if is_file_updated('/etc/neutron/neutron.conf', $title) {
|
||||
notify{'neutron.conf has been changed, going to restart dhcp agent':
|
||||
} ~> Service['neutron-dhcp-service']
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,4 +55,8 @@ class openstack_tasks::openstack_network::agents::l3 {
|
|||
|
||||
}
|
||||
|
||||
if is_file_updated('/etc/neutron/neutron.conf', $title) {
|
||||
notify{'neutron.conf has been changed, going to restart l3 agent':
|
||||
} ~> Service['neutron-l3']
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,4 +57,8 @@ class openstack_tasks::openstack_network::agents::metadata {
|
|||
|
||||
}
|
||||
|
||||
if is_file_updated('/etc/neutron/neutron.conf', $title) {
|
||||
notify{'neutron.conf has been changed, going to restart neutron metadata':
|
||||
} ~> Service['neutron-ovs-metadata']
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,6 +110,11 @@ class openstack_tasks::openstack_network::plugins::ml2 {
|
|||
'securitygroup/enable_security_group': value => $enable_security_group;
|
||||
}
|
||||
|
||||
if is_file_updated('/etc/neutron/neutron.conf', $title) {
|
||||
notify{'neutron.conf has been changed, going to restart ovs agent':
|
||||
} ~> Service['neutron-ovs-agent-service']
|
||||
}
|
||||
|
||||
Neutron_agent_ovs<||> ~> Service['neutron-ovs-agent-service']
|
||||
|
||||
class { '::neutron::agents::ml2::ovs':
|
||||
|
|
|
@ -254,4 +254,8 @@ class openstack_tasks::openstack_network::server_config {
|
|||
|
||||
}
|
||||
|
||||
if is_file_updated('/etc/neutron/neutron.conf', $title) {
|
||||
notify{'neutron.conf has been changed, going to restart neutron server':
|
||||
} ~> Service['neutron-server']
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
require 'digest/md5'
|
||||
|
||||
module Puppet::Parser::Functions
|
||||
newfunction(:is_file_updated, :type => :rvalue, :arity => 2,
|
||||
:doc => <<-EOS
|
||||
Check, that the file was updated since last function execution
|
||||
for specific entity (e.g. class name)
|
||||
EOS
|
||||
) do |args|
|
||||
|
||||
file = args[0]
|
||||
entity = args[1]
|
||||
|
||||
store_dir = "/var/cache/fuel/#{entity}"
|
||||
store_file = "#{File.basename(file).gsub('/','___')}"
|
||||
fullpath = "#{store_dir}/#{store_file}"
|
||||
|
||||
FileUtils.mkdir_p store_dir
|
||||
|
||||
actual_hash = Digest::MD5.hexdigest(File.read(file)) rescue ""
|
||||
old_hash = File.read(fullpath) rescue ""
|
||||
|
||||
File.write(fullpath, actual_hash)
|
||||
|
||||
actual_hash != old_hash
|
||||
|
||||
end
|
||||
end
|
|
@ -12,6 +12,10 @@ describe manifest do
|
|||
MockFunction.new(:is_pkg_installed) do |function|
|
||||
allow(function).to receive(:call).and_return false
|
||||
end
|
||||
Noop.puppet_function_load :is_file_updated
|
||||
MockFunction.new('is_file_updated') { |function|
|
||||
allow(function).to receive(:call).and_return false
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples 'catalog' do
|
||||
|
|
|
@ -13,6 +13,10 @@ describe manifest do
|
|||
MockFunction.new(:is_pkg_installed) do |function|
|
||||
allow(function).to receive(:call).and_return false
|
||||
end
|
||||
Noop.puppet_function_load :is_file_updated
|
||||
MockFunction.new('is_file_updated') { |function|
|
||||
allow(function).to receive(:call).and_return false
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples 'catalog' do
|
||||
|
|
|
@ -13,6 +13,10 @@ describe manifest do
|
|||
MockFunction.new(:is_pkg_installed) do |function|
|
||||
allow(function).to receive(:call).and_return false
|
||||
end
|
||||
Noop.puppet_function_load :is_file_updated
|
||||
MockFunction.new('is_file_updated') { |function|
|
||||
allow(function).to receive(:call).and_return false
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples 'catalog' do
|
||||
|
|
|
@ -13,6 +13,10 @@ describe manifest do
|
|||
MockFunction.new(:is_pkg_installed) do |function|
|
||||
allow(function).to receive(:call).and_return false
|
||||
end
|
||||
Noop.puppet_function_load :is_file_updated
|
||||
MockFunction.new('is_file_updated') { |function|
|
||||
allow(function).to receive(:call).and_return false
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples 'catalog' do
|
||||
|
@ -162,5 +166,3 @@ describe manifest do
|
|||
end
|
||||
test_ubuntu_and_centos manifest
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@ describe manifest do
|
|||
MockFunction.new(:is_pkg_installed) do |function|
|
||||
allow(function).to receive(:call).and_return false
|
||||
end
|
||||
Noop.puppet_function_load :is_file_updated
|
||||
MockFunction.new('is_file_updated') { |function|
|
||||
allow(function).to receive(:call).and_return false
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples 'catalog' do
|
||||
|
|
Loading…
Reference in New Issue