Restart neutron-vpn-agent in l3_agent recipe when vpn is enabled

As there are some potential problems when neutron-l3-agent and
neutron-vpn-agent services are both running in the network node,
we should disable and stop neutron-l3-agent service.

The l3_agent recipe will be executed when running vpn_agent recipe,
so when firewall is enabled, restart neutron-vpn-agent service
instead of neutron-l3-agent service.

Closes-Bug: #1452121
Change-Id: I3d9ae89994770846094e24b3355ffad1a4e0d9ef
This commit is contained in:
Song Li 2015-05-06 05:16:13 -04:00
parent ae7a80fcd4
commit f185099581
2 changed files with 15 additions and 2 deletions

View File

@ -66,7 +66,9 @@ end
service 'neutron-l3-agent' do
service_name platform_options['neutron_l3_agent_service']
supports status: true, restart: true
# if the vpn agent is enabled, we should stop and disable the l3 agent
# As l3 and vpn agents are both working based on l3 bisic strategy, and there will be
# potential synchronization problems when vpn and l3 agents both running in network node.
# So if the vpn agent is enabled, we should stop and disable the l3 agent.
if node['openstack']['network']['enable_vpn']
action [:stop, :disable]
else
@ -92,6 +94,7 @@ template '/etc/neutron/l3_agent.ini' do
variables(
agent_mode: agent_mode
)
# Not restart l3 agent to avoid synchronization problem, when vpn agent is enabled.
unless node['openstack']['network']['enable_vpn']
notifies :restart, 'service[neutron-l3-agent]', :immediately
end
@ -103,7 +106,12 @@ template node['openstack']['network']['fwaas']['config_file'] do
user node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode 00640
notifies :restart, 'service[neutron-l3-agent]', :immediately
# Only restart vpn agent to avoid synchronization problem, when vpn agent is enabled.
if node['openstack']['network']['enable_vpn']
notifies :restart, 'service[neutron-vpn-agent]', :delayed
else
notifies :restart, 'service[neutron-l3-agent]', :immediately
end
end
driver_name = node['openstack']['network']['interface_driver'].split('.').last

View File

@ -150,6 +150,11 @@ describe 'openstack-network::l3_agent' do
it 'upgrades neutron fwaas package' do
expect(chef_run).to upgrade_package('python-neutron-fwaas')
end
it 'notifies the l3 agent service when vpn is not enabled' do
node.set['openstack']['network']['enable_vpn'] = false
expect(file).to notify('service[neutron-l3-agent]').to(:restart).immediately
end
end
describe 'create ovs bridges' do