1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-19 06:50:07 +03:00

F #4089: Improve firecracker clean.sh (#4319)

This commit is contained in:
Christian González 2020-03-06 09:45:55 +01:00 committed by GitHub
parent 363e3f1b56
commit 8e6831ca47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,8 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
source /var/tmp/one/scripts_common.sh
# exit when any command fails
set -e
@ -62,14 +64,20 @@ function wait_cgroup () {
[ ! -z "$(lsof $1)" ]; do continue; done
}
DIR="$CGROUP_PATH/cpu/firecracker/$VM_NAME"
wait_cgroup $DIR
if [ -d "$DIR" ]; then rmdir "$DIR"; fi
function clean_cgroups () {
DIR="$CGROUP_PATH/cpu/firecracker/$VM_NAME"
wait_cgroup $DIR
if [ -d "$DIR" ]; then rmdir "$DIR"; fi
DIR="$CGROUP_PATH/cpuset/firecracker/$VM_NAME"
wait_cgroup $DIR
if [ -d "$DIR" ]; then rmdir "$DIR"; fi
DIR="$CGROUP_PATH/cpuset/firecracker/$VM_NAME"
wait_cgroup $DIR
if [ -d "$DIR" ]; then rmdir "$DIR"; fi
DIR="$CGROUP_PATH/pids/firecracker/$VM_NAME"
wait_cgroup $DIR
if [ -d "$DIR" ]; then rmdir "$DIR"; fi
DIR="$CGROUP_PATH/pids/firecracker/$VM_NAME"
wait_cgroup $DIR
if [ -d "$DIR" ]; then rmdir "$DIR"; fi
}
retry 3 clean_cgroups
exit 0