Fix resource deallocation

Change-Id: I8e9c7964c923f1c8c709897e73ccc240c571bd76
Partial-Bug: #1611432
This commit is contained in:
Mykyta Karpin 2016-11-15 14:14:18 +02:00
parent 3dab1753fb
commit 4b32ce9710
3 changed files with 38 additions and 14 deletions

View File

@ -10,8 +10,25 @@
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_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
onfailure: false
script-only-if-succeeded: false

View File

@ -246,21 +246,31 @@ function ensure_no_heat_stacks_left() {
local log_file="${STACK_HOME}/log/murano-engine.log"
local retval=0
pushd "${STACK_HOME}/devstack"
for id in $(sed -n 's/.*\"OS\:\:stack_id\"\: \"\(.\{36\}\)\".*/\1/p' "${log_file}" | sort | uniq); do
stack_info=$(heat stack-list | grep "${id}")
if [ -n "${stack_info}" ]; then
retval=1
echo "Stack '${id}' found!"
echo "${stack_info}"
echo "Deleting stack '${id}'"
heat stack-delete "${id}" > /dev/null
for stack_name in $(grep -oP '(?<=generatedStackName\", \").*?(?=\"]+, )' "${log_file}" | sort | uniq); do
# get string, containing stack id
stack_id_string=$(openstack stack list | grep "${stack_name}" | cut -d '|' -f 2)
# strip spaces
stack_id="${stack_id_string//[[:blank:]]/}"
if [ -n "${stack_id}" ]; then
retval=1
stack_info=$(openstack stack list | grep "${stack_id}")
set +o xtrace
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
done
popd
return $retval
}
@ -269,5 +279,4 @@ function tear_down() {
if [[ "${PROJECT_NAME}" == 'murano-agent' ]]; then
remove_image_with_murano_agent
fi
ensure_no_heat_stacks_left
}

View File

@ -126,8 +126,6 @@ EOF
popd
ensure_no_heat_stacks_left || retval=$?
return $retval
}