Bug 2232577 - Impossible to remove SD in inactive state via ansible, despite "destroy: true". Via API or UI works as intended
Summary: Impossible to remove SD in inactive state via ansible, despite "destroy: true...
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-ansible-collection
Version: 4.5.3
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: Martin Perina
QA Contact: Lukas Svaty
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-08-17 12:55 UTC by Andrea Perotti
Modified: 2023-08-17 13:00 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Andrea Perotti 2023-08-17 12:55:41 UTC
Description of problem:

While using the redhat.rhv.ovirt_storage_domain module from the redhat.rhv v2.4.2-1 collection, we are facing this scenario:

* Disaster (or simulation thereof) happens: LUNs are not accessible anymore, I/O is denied to the hypervisors.
* The only Storage Domain in the DataCenter goes into Inactive state. It was the master SD.
* No VMs are running (to simplify the scenario)
* At this time, if we need to perform a cleanup (i.e. remove/destroy the faulted SD) we would call the following task with Ansible:

- name: Destroy SD
  redhat.rhv.ovirt_storage_domain:
    auth: "{{ ovirt_auth }}"
    data_center: "{{ dc_name }}"
    name: "{{ sd_name }}"
    state: absent
    destroy: true
    wait: true
    host: "{{ one_of_the_cluster_hosts }}"

* The task always fails with Exception "Not possible to manage storage domain" because of function control_state() in ./plugins/modules/ovirt_storage_domain.py. The function checks whether the SD is in Unknown or Inactive state and in that case refuses to continue. 


Version-Release number of selected component (if applicable):
ovirt-ansible-collection-2.4.2-1.el8ev.noarch


Actual results:

* The function is called too early without taking into account the "destroy: true" variable. This means there is no way to reach the actual code calling the oVirt API for removing the SD.
* Manually performing the same operation - either via RHVM GUI, curl or ansible uri module - always succeeds.


Note You need to log in before you can comment on or make changes to this bug.