The command use to check if bridge are setup is not reliable.
On some plateform or verion of ovs the ouput of ovs-vsctl show have quote or not. This patch implement a other method to check if bridge exist. Co-Authored-By: Stephan Renatus <s.renatus@x-ion.de> Change-Id: Iaae683213f281529e2167ac326d8e9573f026f12 Closes-Bug: #1266558
This commit is contained in:
parent
aafd5ced9c
commit
59858a4545
|
@ -57,7 +57,7 @@ unless %w(nicira plumgrid bigswitch linuxbridge).include?(main_plugin)
|
|||
execute 'create external network bridge' do
|
||||
command "ovs-vsctl add-br #{ext_bridge} && ovs-vsctl add-port #{ext_bridge} #{ext_bridge_iface}"
|
||||
action :run
|
||||
not_if "ovs-vsctl show | grep 'Bridge \"#{ext_bridge}\"'"
|
||||
not_if "ovs-vsctl br-exists #{ext_bridge}"
|
||||
only_if "ip link show #{ext_bridge_iface}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -109,7 +109,7 @@ unless ['nicira', 'plumgrid', 'bigswitch'].include?(main_plugin)
|
|||
ignore_failure true
|
||||
command "ovs-vsctl add-br #{int_bridge}"
|
||||
action :run
|
||||
not_if "ovs-vsctl show | grep 'Bridge \"#{int_bridge}\"'"
|
||||
not_if "ovs-vsctl br-exists #{int_bridge}"
|
||||
notifies :restart, 'service[neutron-plugin-openvswitch-agent]', :delayed
|
||||
end
|
||||
end
|
||||
|
@ -120,7 +120,7 @@ unless ['nicira', 'plumgrid', 'bigswitch'].include?(main_plugin)
|
|||
ignore_failure true
|
||||
command "ovs-vsctl add-br #{tun_bridge}"
|
||||
action :run
|
||||
not_if "ovs-vsctl show | grep 'Bridge \"#{tun_bridge}\"'"
|
||||
not_if "ovs-vsctl br-exists #{tun_bridge}"
|
||||
notifies :restart, 'service[neutron-plugin-openvswitch-agent]', :delayed
|
||||
end
|
||||
end
|
||||
|
|
|
@ -72,28 +72,28 @@ describe 'openstack-network::l3_agent' do
|
|||
cmd = 'ovs-vsctl add-br br-ex && ovs-vsctl add-port br-ex eth1'
|
||||
|
||||
it "doesn't add the external bridge if it already exists" do
|
||||
stub_command(/ovs-vsctl show/).and_return(true)
|
||||
stub_command(/ovs-vsctl br-exists/).and_return(true)
|
||||
stub_command(/ip link show eth1/).and_return(true)
|
||||
@chef_run.converge 'openstack-network::l3_agent'
|
||||
expect(@chef_run).not_to run_execute(cmd)
|
||||
end
|
||||
|
||||
it "doesn't add the external bridge if the physical interface doesn't exist" do
|
||||
stub_command(/ovs-vsctl show/).and_return(true)
|
||||
stub_command(/ovs-vsctl br-exists/).and_return(true)
|
||||
stub_command(/ip link show eth1/).and_return(false)
|
||||
@chef_run.converge 'openstack-network::l3_agent'
|
||||
expect(@chef_run).not_to run_execute(cmd)
|
||||
end
|
||||
|
||||
it 'adds the external bridge if it does not yet exist' do
|
||||
stub_command(/ovs-vsctl show/).and_return(false)
|
||||
stub_command(/ovs-vsctl br-exists/).and_return(false)
|
||||
stub_command(/ip link show eth1/).and_return(true)
|
||||
@chef_run.converge 'openstack-network::l3_agent'
|
||||
expect(@chef_run).to run_execute(cmd)
|
||||
end
|
||||
|
||||
it 'adds the external bridge if the physical interface exists' do
|
||||
stub_command(/ovs-vsctl show/).and_return(false)
|
||||
stub_command(/ovs-vsctl br-exists/).and_return(false)
|
||||
stub_command(/ip link show eth1/).and_return(true)
|
||||
@chef_run.converge 'openstack-network::l3_agent'
|
||||
expect(@chef_run).to run_execute(cmd)
|
||||
|
|
|
@ -73,8 +73,8 @@ def neutron_stubs # rubocop:disable MethodLength
|
|||
::Chef::Application.stub(:fatal!)
|
||||
|
||||
stub_command('dpkg -l | grep openvswitch-switch | grep 1.10.2-1').and_return(true)
|
||||
stub_command("ovs-vsctl show | grep 'Bridge \"br-int\"'").and_return(false)
|
||||
stub_command("ovs-vsctl show | grep 'Bridge \"br-tun\"'").and_return(false)
|
||||
stub_command('ovs-vsctl br-exists br-int').and_return(false)
|
||||
stub_command('ovs-vsctl br-exists br-tun').and_return(false)
|
||||
stub_command('ip link show eth1').and_return(false)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue