From 88fab7bc949b8cbb7a95351ca75822a6a5bbc97a Mon Sep 17 00:00:00 2001 From: Shubha Kulkarni Date: Thu, 8 Dec 2022 15:57:53 -0500 Subject: [PATCH] DR-Failback errors when gathering/detecting HA VM as well as storage domains Signed-off-by: Shubha Kulkarni --- .../remove_valid_filtered_master_domains.yml | 26 ++++++++++++++----- .../tasks/unregister_entities.yml | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/roles/disaster_recovery/tasks/clean/remove_valid_filtered_master_domains.yml b/roles/disaster_recovery/tasks/clean/remove_valid_filtered_master_domains.yml index b5b21566..5268c47f 100644 --- a/roles/disaster_recovery/tasks/clean/remove_valid_filtered_master_domains.yml +++ b/roles/disaster_recovery/tasks/clean/remove_valid_filtered_master_domains.yml @@ -2,23 +2,37 @@ - name: Remove valid storage domain main block block: - name: Fetch active/maintenance/detached storage domain for remove + ovirt_storage_domain_info: + pattern: > + name={{ storage['dr_' + dr_source_map + '_name'] }} and + datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_active_domain_search }} + auth: "{{ ovirt_auth }}" + register: storage_domain_info_active + + - name: Fetch maintenance storage domain for remove + ovirt_storage_domain_info: + pattern: > + name={{ storage['dr_' + dr_source_map + '_name'] }} and + datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_maintenance_domain_search }} + auth: "{{ ovirt_auth }}" + register: storage_domain_info_maintenance + + - name: Fetch detached storage domain for remove ovirt_storage_domain_info: pattern: > name={{ storage['dr_' + dr_source_map + '_name'] }} and - ( - datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_active_domain_search }} or - datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_maintenance_domain_search }} or {{ dr_unattached_domain_search }} - ) auth: "{{ ovirt_auth }}" - register: storage_domain_info + register: storage_domain_info_detached - name: Remove valid storage domain include_tasks: remove_domain_process.yml vars: sd: "{{ sd }}" with_items: - - "{{ storage_domain_info.ovirt_storage_domains }}" + - "{{ storage_domain_info_active.ovirt_storage_domains }}" + - "{{ storage_domain_info_maintenance.ovirt_storage_domains }}" + - "{{ storage_domain_info_detached.ovirt_storage_domains }}" when: (not only_master and not sd.master) or (only_master and sd.master) loop_control: loop_var: sd diff --git a/roles/disaster_recovery/tasks/unregister_entities.yml b/roles/disaster_recovery/tasks/unregister_entities.yml index e7ad22ab..64b6d0ac 100644 --- a/roles/disaster_recovery/tasks/unregister_entities.yml +++ b/roles/disaster_recovery/tasks/unregister_entities.yml @@ -27,7 +27,7 @@ - name: Init list property for running_vms ansible.builtin.set_fact: - res_ovirt_vms="[]" + res_ovirt_vms=[] - name: Map all running VMs in fact ansible.builtin.set_fact: