Wait for new ovs ctl file
Sometimes the poststart function on a pod restart completes too quickly, resulting in chown command running on the incorrect file. Change-Id: I2eca5b148f13c48314501c955723bf759ffaa4fc
This commit is contained in:
parent
0d4dd84f59
commit
b76240f1df
@ -15,7 +15,7 @@ apiVersion: v1
|
||||
appVersion: v1.0.0
|
||||
description: OpenStack-Helm OpenVSwitch
|
||||
name: openvswitch
|
||||
version: 0.1.16
|
||||
version: 0.1.17
|
||||
home: http://openvswitch.org
|
||||
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Neutron/OpenStack_Project_Neutron_vertical.png
|
||||
sources:
|
||||
|
@ -107,13 +107,37 @@ function stop () {
|
||||
ovs-appctl -T1 -t /run/openvswitch/ovs-vswitchd.${PID}.ctl exit
|
||||
}
|
||||
|
||||
find_latest_ctl_file() {
|
||||
latest_file=""
|
||||
latest_file=$(ls -lt /run/openvswitch/*.ctl | awk 'NR==1 {if ($3 == "{{ .Values.conf.poststart.rootUser }}") print $NF}')
|
||||
|
||||
echo "$latest_file"
|
||||
}
|
||||
|
||||
function poststart () {
|
||||
# This enables the usage of 'ovs-appctl' from neutron-ovs-agent pod.
|
||||
|
||||
# Wait for potential new ctl file before continuing
|
||||
timeout={{ .Values.conf.poststart.timeout }}
|
||||
start_time=$(date +%s)
|
||||
while true; do
|
||||
latest_ctl_file=$(find_latest_ctl_file)
|
||||
if [ -n "$latest_ctl_file" ]; then
|
||||
break
|
||||
fi
|
||||
current_time=$(date +%s)
|
||||
if (( current_time - start_time >= timeout )); then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
until [ -f $OVS_PID ]
|
||||
do
|
||||
echo "Waiting for file $OVS_PID"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
PID=$(cat $OVS_PID)
|
||||
OVS_CTL=/run/openvswitch/ovs-vswitchd.${PID}.ctl
|
||||
|
||||
|
@ -208,6 +208,9 @@ manifests:
|
||||
secret_registry: true
|
||||
|
||||
conf:
|
||||
poststart:
|
||||
timeout: 5
|
||||
rootUser: "root"
|
||||
openvswitch_db_server:
|
||||
ptcp_port: null
|
||||
ovs_other_config:
|
||||
|
@ -17,4 +17,5 @@ openvswitch:
|
||||
- 0.1.14 Add buffer before accesses pid file
|
||||
- 0.1.15 Add buffer before accesses ovs controller pid socket
|
||||
- 0.1.16 Restore ServiceAccount to openvswitch pod
|
||||
- 0.1.17 Add buffer to wait for potential new CTL file before running chown
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user