ovirt-ansible-collection icon indicating copy to clipboard operation
ovirt-ansible-collection copied to clipboard

ovirt_storage_domain: Unable to import domain

Open jwahsnakupaku opened this issue 1 year ago • 2 comments

SUMMARY

Hi, I'm trying to import a storage domain on a host I'm rebuilding. When running the ansible playbook, it doesn't appear to be even attempting it as the error is referencing a missing name parameter for add.

COMPONENT NAME

ovirt_storage_domain: Import existing storage domain. Running;

  • oVirt engine: 4.4.10.7-1.el8
  • ansible-core: 2.13.2
  • ovirt.ovirt collection: 2.2.2
  • ovirt-engine-sdk-python: 4.5.2 (have tried 4.4.15 as well).
STEPS TO REPRODUCE

Attempt to import a storage domain.

Here is the existing directory I'm trying to import as storage domain.

ls -l /data/images/
total 0
drwxr-xr-x. 5 vdsm kvm 64 Aug 15 15:00 c86e575b-266b-4a62-851b-27863b972a37
-rwxr-xr-x. 1 vdsm kvm  0 Jul  2  2021 __DIRECT_IO_TEST__

Here's the play;

        - name: Import storage domain
          ovirt.ovirt.ovirt_storage_domain:
            auth: "{{ ovirt_auth }}"
            data_center: "dcname"
            state: imported
            host: "hostname"
            id: 'c86e575b-266b-4a62-851b-27863b972a37'
            localfs:
              path: /data/images
EXPECTED RESULTS

Domain imports successfully or at least gives an error relevant to importing a storage domain rather than adding. I'm able to import through the oVirt UI without issues

ACTUAL RESULTS

Task fails referencing a missing parameter for Add. Documentation references that name isn't required for state imported. https://docs.ansible.com/ansible/latest/collections/ovirt/ovirt/ovirt_storage_domain_module.html#parameter-name

TASK [Import storage domain] *************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ovirtsdk4.Error: Fault reason is "Incomplete parameters". Fault detail is "StorageDomain [name] required for add". HTTP response code is 400.
fatal: [hostname.domain.local -> localhost]: FAILED! => {"changed": false, "msg": "Fault reason is \"Incomplete parameters\". Fault detail is \"StorageDomain [name] required for add\". HTTP response code is 400."}

Adding a name parameter, caused it to fail at import (as there is an existing domain present).

TASK [Import storage domain] ******************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ovirtsdk4.Error: Fault reason is "Operation Failed". Fault detail is "[Error in creating a Storage Domain. The selected storage path is not empty (probably contains another Storage Domain). Either remove the existing Storage Domain from this path, or change the Storage path).]". HTTP response code is 400.
fatal: [hostname.domain.local -> localhost]: FAILED! => {"changed": false, "msg": "Fault reason is \"Operation Failed\". Fault detail is \"[Error in creating a Storage Domain. The selected storage path is not empty (probably contains another Storage Domain). Either remove the existing Storage Domain from this path, or change the Storage path).]\". HTTP response code is 400."}

jwahsnakupaku avatar Aug 15 '22 05:08 jwahsnakupaku

@barpavel could you please take a look?

mwperina avatar Aug 16 '22 08:08 mwperina

BTW, added a Jira ticket: https://issues.redhat.com/browse/RHV-47841

barpavel avatar Aug 21 '22 11:08 barpavel