From aab3c67b07d60ba8acf662490df6acb102f9bae1 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Mon, 21 Dec 2020 09:17:48 +0000 Subject: [PATCH 1/3] Only destroy volumes of type volume or network Other volume types (e.g. file) do not need to be destroyed. Fixes: #73 --- tasks/destroy-volumes.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/destroy-volumes.yml b/tasks/destroy-volumes.yml index e529177..619ed73 100644 --- a/tasks/destroy-volumes.yml +++ b/tasks/destroy-volumes.yml @@ -5,6 +5,7 @@ {{ item.name }} {{ item.pool }} with_items: "{{ volumes }}" + when: item.type | default(libvirt_volume_default_type) in ['volume', 'network'] register: volume_result environment: "{{ libvirt_vm_script_env }}" changed_when: From 8c8572b5bf5a5fdd69021862486693845a831198 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Mon, 21 Dec 2020 09:37:37 +0000 Subject: [PATCH 2/3] Specify a default for pool in destroy-volumes.yml --- tasks/destroy-volumes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/destroy-volumes.yml b/tasks/destroy-volumes.yml index 619ed73..1162f2b 100644 --- a/tasks/destroy-volumes.yml +++ b/tasks/destroy-volumes.yml @@ -3,7 +3,7 @@ script: > destroy_virt_volume.sh {{ item.name }} - {{ item.pool }} + {{ item.pool | default('default') }} with_items: "{{ volumes }}" when: item.type | default(libvirt_volume_default_type) in ['volume', 'network'] register: volume_result From cb6251b0eef2634f7901842b65df36a1786855aa Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Mon, 21 Dec 2020 10:59:16 +0000 Subject: [PATCH 3/3] Update destroy-volumes.yml --- tasks/destroy-volumes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/destroy-volumes.yml b/tasks/destroy-volumes.yml index 1162f2b..b7c0704 100644 --- a/tasks/destroy-volumes.yml +++ b/tasks/destroy-volumes.yml @@ -5,7 +5,7 @@ {{ item.name }} {{ item.pool | default('default') }} with_items: "{{ volumes }}" - when: item.type | default(libvirt_volume_default_type) in ['volume', 'network'] + when: item.type | default(libvirt_volume_default_type) == 'volume' register: volume_result environment: "{{ libvirt_vm_script_env }}" changed_when: