lib.sh: cleanup_vms: Also remove stopped MCP VMs 11/38211/1
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Wed, 26 Jul 2017 16:53:04 +0000 (18:53 +0200)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Wed, 26 Jul 2017 16:56:43 +0000 (18:56 +0200)
In case the cfg01 & co. VMs are in "shut off" state, `virsh --name`
will ommit them, which leads to `cleanup_vms` leaving behind stale
VMs. Add `--all` arg to list all VMs, including stopped ones.

Change-Id: Ia550a10eb0b40138f87ade709336c2871a8b1cd8
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
mcp/scripts/lib.sh

index 1848c70..6fa330a 100644 (file)
@@ -16,7 +16,7 @@ get_base_image() {
 
 cleanup_vms() {
   # clean up existing nodes
-  for node in $(virsh list --name | grep -P '\w{3}\d{2}'); do
+  for node in $(virsh list --name --all | grep -P '\w{3}\d{2}'); do
     virsh destroy $node
     virsh undefine $node
   done