Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ovirt_storage_domain_info: Retrieve status attribute #658

Open
Gounick opened this issue Jan 9, 2023 · 0 comments
Open

ovirt_storage_domain_info: Retrieve status attribute #658

Gounick opened this issue Jan 9, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@Gounick
Copy link

Gounick commented Jan 9, 2023

SUMMARY

Retrieve status attribute of Storage Domain.

I need to know if a storage domain is under maintenance or not: status attribute contains the information sought.

The ovirt.ovirt.ovirt_storage_domain_info module does not show the status attribute.

COMPONENT NAME

ovirt.ovirt.ovirt_storage_domain_info module

ADDITIONAL INFORMATION

The API document describes an endpoint to retrieve this information:

but this /ovirt-engine/api/storagedomains/<id> endpoint does not show it.

We have to go through another endpoint to retrieve it : /ovirt-engine/api/datacenters/<id>/storagedomains and the ovirt.ovirt.ovirt_datacenter_info module does not show it like this endpoint.

VERSION
  • oVirt engine 4.3 and 4.4
  • Latest SDK Python (pip package)
  • Latest ovirt.ovirt collection
  • Ansible-core 2.12 (pip package)
  • Python 3.10
STEPS TO REPRODUCE
status attribute does not exist:
- name: "Fetch the datacenter name associated with {{ cluster }} cluster."
  ovirt.ovirt.ovirt_datacenter_info:
    auth: "{{ ovirt_auth }}"
    pattern: "Clusters.name = {{ cluster }}"
  register: result_ovirt_datacenter_info

- name: Retrieve information about storage domains
  ovirt.ovirt.ovirt_storage_domain_info:
    auth: "{{ ovirt_auth }}"
    pattern: "datacenter={{ result_ovirt_datacenter_info.ovirt_datacenters[0].name }}"
    fetch_nested: true
  register: result_ovirt_storage_domain_info

- ansible.builtin.debug:
    var: result_ovirt_storage_domain_info.ovirt_storage_domains
          | selectattr('status', 'defined')
          | selectattr('status', 'equalto', 'active')
status attribute is present:
- name: "Fetch the datacenter name associated with {{ cluster }} cluster."
  ovirt.ovirt.ovirt_datacenter_info:
    auth: "{{ ovirt_auth }}"
    pattern: "Clusters.name = {{ cluster }}"
  register: result_ovirt_datacenter_info

- name: Retrieve information about storage domains
  ansible.builtin.uri:
    url: "https://{{ engine_fqdn + result_ovirt_datacenter_info.ovirt_datacenters[0].href }}/storagedomains"
    method: GET
    validate_certs: false
    body_format: json
    headers:
      Accept: application/json
      Authorization: "Bearer {{ ovirt_auth.token }}"
  register: result_ovirt_storage_domain_info

- ansible.builtin.debug:
    var: result_ovirt_storage_domain_info.json.storage_domain
          | selectattr('status', 'defined')
          | selectattr('status', 'equalto', 'active')
EXPECTED RESULTS

Retrieve the status attribute of a Storage Domain as described in the API documentation.

@Gounick Gounick added the bug Something isn't working label Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant