Merge "Remove container dependencies on sysinv-conductor shutdown"
This commit is contained in:
commit
a35ab297d9
|
@ -224,6 +224,44 @@ sysinv_conductor_start () {
|
|||
return ${rc}
|
||||
}
|
||||
|
||||
sysinv_remove_application_containers() {
|
||||
local containers='armada_service'
|
||||
local rc
|
||||
|
||||
# The entry point for this is when the conductor has been confirmed to be
|
||||
# stopped. Now cleanup any dependent service containers. This will be done
|
||||
# here until we re-factor the management of (i.e. catch SIGKILL and cleanup)
|
||||
# or the retirement of (i.e. move armada to a pod) these dependencies
|
||||
|
||||
# On a non K8S configuration docker status will be EXIT_NOTIMPLEMENTED
|
||||
systemctl status docker 2>&1 >> /dev/null
|
||||
rc=$?
|
||||
if [ $rc -eq 3 ]; then
|
||||
ocf_log info "${proc} Docker is not running, skipping container actions. (sysinv-conductor)"
|
||||
return
|
||||
fi
|
||||
|
||||
# Shutdown containers with DRBD dependencies that would prevent a swact.
|
||||
for c in $containers; do
|
||||
local id
|
||||
|
||||
# does the container exist
|
||||
id=$(docker container ls -qf name=${c} 2>/dev/null)
|
||||
if [ ! -n "$id" ]; then
|
||||
ocf_log info "${proc} Container $c is not present, skipping container actions. (sysinv-conductor)"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Graceful shutdown (default is 10 sec, then kill)
|
||||
ocf_log info "${proc} About to stop container $c... (sysinv-conductor)"
|
||||
docker stop $c 2>&1 >> /dev/null
|
||||
|
||||
# Cleanup the container. Use force just in case.
|
||||
ocf_log info "${proc} About to remove container $c... (sysinv-conductor)"
|
||||
docker rm -f $c 2>&1 >> /dev/null
|
||||
done
|
||||
}
|
||||
|
||||
sysinv_conductor_confirm_stop() {
|
||||
local my_bin
|
||||
local my_processes
|
||||
|
@ -252,6 +290,9 @@ sysinv_conductor_stop () {
|
|||
if [ $rc -eq $OCF_NOT_RUNNING ]; then
|
||||
ocf_log info "${proc} Sysinv Conductor (sysinv-conductor) already stopped"
|
||||
sysinv_conductor_confirm_stop
|
||||
|
||||
sysinv_remove_application_containers
|
||||
|
||||
return ${OCF_SUCCESS}
|
||||
fi
|
||||
|
||||
|
@ -292,6 +333,8 @@ sysinv_conductor_stop () {
|
|||
fi
|
||||
sysinv_conductor_confirm_stop
|
||||
|
||||
sysinv_remove_application_containers
|
||||
|
||||
ocf_log info "${proc} Sysinv Conductor (sysinv-conductor) stopped."
|
||||
|
||||
rm -f $OCF_RESKEY_pid
|
||||
|
|
Loading…
Reference in New Issue