Adds check and resyncs ODL/OVS OF pipeline
Some flows may be missing in OVS (on a per table basis) when deploying with OpenDaylight. There is no OpenDaylight fix yet for this issue, so this patch implements a workaround. The workaround is to check if all the tables exist on each OVS node. If they are missing, then reset the OpenFlow connection to the ODL controller, which will result in ODL pushing the flows again and inserting the missing flows. Closes-Bug: 1775436 Change-Id: I28d13a26198268cfd1f3e9e64236605f24319a04 Signed-off-by: Tim Rozet <trozet@redhat.com>
This commit is contained in:
parent
e1ecbb129c
commit
199ddad31b
53
lib/puppet/functions/synchronize_odl_ovs_flows.rb
Normal file
53
lib/puppet/functions/synchronize_odl_ovs_flows.rb
Normal file
@ -0,0 +1,53 @@
|
||||
Puppet::Functions.create_function(:synchronize_odl_ovs_flows) do
|
||||
dispatch :synchronize_odl_ovs_flows do
|
||||
param 'String', :of_controller_uri
|
||||
end
|
||||
|
||||
def synchronize_odl_ovs_flows(of_controller_uri)
|
||||
flow_tables = [
|
||||
17, 18, 19, 20, 22, 23, 24, 43, 45, 48, 50, 51, 60, 80, 81, 90, 210, 211,
|
||||
212, 213, 214, 215, 216, 217, 239, 240, 241, 242, 243, 244, 245, 246, 247
|
||||
]
|
||||
retries = 5
|
||||
i = 0
|
||||
# wait for controller to be set
|
||||
while i <= retries
|
||||
of_ctrlr = `ovs-vsctl get-controller br-int`
|
||||
if !of_ctrlr.empty?
|
||||
break
|
||||
end
|
||||
i = i + 1
|
||||
sleep(5)
|
||||
end
|
||||
if i >= 6
|
||||
raise Puppet::Error, "OF controller for OVS was never set by ODL"
|
||||
end
|
||||
|
||||
# check OF pipeline, and resync if necessary
|
||||
i = 0
|
||||
while i <= retries
|
||||
of_synchronized = true
|
||||
flow_tables.each do |table|
|
||||
of_output = `ovs-ofctl -O openflow13 dump-flows br-int | grep table=#{table}`
|
||||
if of_output.empty?
|
||||
of_synchronized = false
|
||||
break
|
||||
end
|
||||
end
|
||||
# check if need to resync
|
||||
if of_synchronized == true
|
||||
return true
|
||||
else
|
||||
resync_output = `ovs-vsctl del-controller br-int && ovs-vsctl set-controller br-int #{of_controller_uri}`
|
||||
if ! ($?.exited? && $?.exitstatus == 0)
|
||||
raise Puppet::Error, "Unable to reset OpenFlow controller for bridge br-int: #{resync_output}"
|
||||
end
|
||||
end
|
||||
i = i + 1
|
||||
# wait for openflow pipeline to be pushed by ODL
|
||||
sleep(10)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
end
|
@ -130,4 +130,12 @@ class tripleo::profile::base::neutron::plugins::ovs::opendaylight (
|
||||
tls_cert_file => $tls_certfile
|
||||
}
|
||||
}
|
||||
|
||||
if $step >= 5 {
|
||||
$odl_of_mgr = regsubst($odl_ovsdb_str , ':6640', ':6653')
|
||||
# Workaround until OpenDayight is capable of synchronizing flows
|
||||
if ! synchronize_odl_ovs_flows($odl_of_mgr) {
|
||||
fail('Failed to validate OVS OpenFlow pipeline')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes an issue where OVS may be missing flows post-deployment with
|
||||
OpenDaylight. For more information see
|
||||
https://bugs.launchpad.net/tripleo/+bug/1775436
|
Loading…
x
Reference in New Issue
Block a user