From d5fe8a30f98db9c604cf6a80b63875c06abbf20a Mon Sep 17 00:00:00 2001 From: liyingjun Date: Thu, 13 Oct 2016 17:31:17 +0800 Subject: [PATCH] Cleanup container script improvement Currently, when there are some qemu processes which may be some useful virtual machines running by the operator running on non compute node, the cleanup script will fail the cleanup operation for that node. We need to ignore the qemu process check for non compute nodes. Change-Id: If49a1a30764063935b2a65312de8f3b2357c7fbc Closes-bug: 1633005 --- ansible/roles/destroy/tasks/cleanup_containers.yml | 9 ++++++++- tools/cleanup-containers | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ansible/roles/destroy/tasks/cleanup_containers.yml b/ansible/roles/destroy/tasks/cleanup_containers.yml index 4ccdd9cdd8..c6aee8ef5e 100644 --- a/ansible/roles/destroy/tasks/cleanup_containers.yml +++ b/ansible/roles/destroy/tasks/cleanup_containers.yml @@ -1,3 +1,10 @@ --- -- name: Destroying all Kolla containers and volumes +- name: Destroying all Kolla containers and volumes on compute node + environment: + COMPUTE: true command: /tmp/kolla-cleanup/tools/cleanup-containers + when: inventory_hostname in groups['compute'] + +- name: Destroying all Kolla containers and volumes on non compute node + command: /tmp/kolla-cleanup/tools/cleanup-containers + when: inventory_hostname not in groups['compute'] diff --git a/tools/cleanup-containers b/tools/cleanup-containers index 14249c9605..c73d197dda 100755 --- a/tools/cleanup-containers +++ b/tools/cleanup-containers @@ -1,5 +1,5 @@ #!/bin/bash -if [[ $(pgrep qemu) ]]; then +if [[ $COMPUTE ]] && [[ $(pgrep qemu) ]]; then echo "Some qemu processes were detected." echo "Docker will not be able to stop the nova_libvirt container with those running." echo "Please clean them up before rerunning this script."