Fix resource deallocation
Change-Id: I8e9c7964c923f1c8c709897e73ccc240c571bd76 Partial-Bug: #1611432
This commit is contained in:
parent
3dab1753fb
commit
4b32ce9710
@ -10,8 +10,25 @@
|
|||||||
source "${WORKSPACE}/murano-ci/scripts/common.inc"
|
source "${WORKSPACE}/murano-ci/scripts/common.inc"
|
||||||
#-----------------
|
#-----------------
|
||||||
|
|
||||||
|
pushd "${STACK_HOME}/devstack"
|
||||||
|
set +o xtrace
|
||||||
|
echo "Importing openrc ..."
|
||||||
|
source openrc "${ADMIN_USERNAME}" "${ADMIN_TENANT}"
|
||||||
|
set -o xtrace
|
||||||
|
popd
|
||||||
|
|
||||||
source "${WORKSPACE}/murano-ci/scripts/collect_results.sh"
|
source "${WORKSPACE}/murano-ci/scripts/collect_results.sh"
|
||||||
source "${WORKSPACE}/murano-ci/scripts/collect_logs.sh"
|
source "${WORKSPACE}/murano-ci/scripts/collect_logs.sh"
|
||||||
|
|
||||||
|
# Cleaning up resources
|
||||||
|
sudo pkill murano || true
|
||||||
|
# wait till murano processes gracefully shutdown
|
||||||
|
while pgrep -f murano-api || pgrep -f murano-engine ; do
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
# cleanup stacks
|
||||||
|
ensure_no_heat_stacks_left
|
||||||
|
|
||||||
onsuccess: false
|
onsuccess: false
|
||||||
onfailure: false
|
onfailure: false
|
||||||
script-only-if-succeeded: false
|
script-only-if-succeeded: false
|
||||||
|
@ -246,21 +246,31 @@ function ensure_no_heat_stacks_left() {
|
|||||||
local log_file="${STACK_HOME}/log/murano-engine.log"
|
local log_file="${STACK_HOME}/log/murano-engine.log"
|
||||||
local retval=0
|
local retval=0
|
||||||
|
|
||||||
pushd "${STACK_HOME}/devstack"
|
for stack_name in $(grep -oP '(?<=generatedStackName\", \").*?(?=\"]+, )' "${log_file}" | sort | uniq); do
|
||||||
|
# get string, containing stack id
|
||||||
for id in $(sed -n 's/.*\"OS\:\:stack_id\"\: \"\(.\{36\}\)\".*/\1/p' "${log_file}" | sort | uniq); do
|
stack_id_string=$(openstack stack list | grep "${stack_name}" | cut -d '|' -f 2)
|
||||||
stack_info=$(heat stack-list | grep "${id}")
|
# strip spaces
|
||||||
if [ -n "${stack_info}" ]; then
|
stack_id="${stack_id_string//[[:blank:]]/}"
|
||||||
retval=1
|
if [ -n "${stack_id}" ]; then
|
||||||
echo "Stack '${id}' found!"
|
retval=1
|
||||||
echo "${stack_info}"
|
stack_info=$(openstack stack list | grep "${stack_id}")
|
||||||
echo "Deleting stack '${id}'"
|
set +o xtrace
|
||||||
heat stack-delete "${id}" > /dev/null
|
cat << EOF
|
||||||
|
********************************************************************************
|
||||||
|
*
|
||||||
|
* Stack $stack_id found!
|
||||||
|
* Full stack information:
|
||||||
|
* $stack_info
|
||||||
|
* Deleting stack $stack_id
|
||||||
|
*
|
||||||
|
********************************************************************************
|
||||||
|
EOF
|
||||||
|
set -o xtrace
|
||||||
|
openstack stack delete "${stack_id}" --yes > /dev/null
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
return $retval
|
return $retval
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,5 +279,4 @@ function tear_down() {
|
|||||||
if [[ "${PROJECT_NAME}" == 'murano-agent' ]]; then
|
if [[ "${PROJECT_NAME}" == 'murano-agent' ]]; then
|
||||||
remove_image_with_murano_agent
|
remove_image_with_murano_agent
|
||||||
fi
|
fi
|
||||||
ensure_no_heat_stacks_left
|
|
||||||
}
|
}
|
||||||
|
@ -126,8 +126,6 @@ EOF
|
|||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
ensure_no_heat_stacks_left || retval=$?
|
|
||||||
|
|
||||||
return $retval
|
return $retval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user