Description of problem: Currently we can use the image_template [1] Ansible role to create a template from a qcow or glance image. This request is to expand the role to include importing a template from OVA. We have python API example [2] to do this, the customer would prefer to do it with Ansible though. [1] https://github.com/oVirt/ovirt-ansible-collection/tree/master/roles/image_template Version-Release number of selected component (if applicable): [2] https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/upload_ova_as_vm_or_template.py While we know it is possible to go from OVA -> VM -> Template already by using ovirt_vm and ovirt_template modules, the customer would like to go directly from OVA -> template.
Hi, currently, we are not able to import the template from ova via API it might have required some changes. Ori could you please check maybe it could be added to the API? I added PR on the collection which solves what the users request but it creates the VM from the ova image and then creates a template.
@amashah , can you please clarify what is requested here, is it (1) to ask ovirt-engine/RHVM to import a template from a specified location that the hosts can access as with the UI (2) to upload an OVA you have at hand (locally, on the client side) to ovirt-engine/RHVM as with the above mentioned SDK example Those are not the same as since both the UI and SDK examples were mentioned, I'm a bit confused
We are past 4.5.0 feature freeze, please re-target.
We expected this feature to be implemented in image_template role (as it was mentioned in the bug description) but we found it in the modules. It failed, see details below. Used versions: ovirt-engine-4.5.0.6-0.7.el8ev.noarch ovirt-ansible-collection-2.0.3-1.el8ev.noarch Reproduction steps 1. We couldn't export template as OVA [1] so we exported VM as OVA which worked. 2. We used: --- - name: oVirt image template hosts: localhost connection: local gather_facts: false tasks: - ovirt_auth: url: https://<engine-fqdn>/ovirt-engine/api username: admin@internal ca_file: /etc/pki/ovirt-engine/ca.pem password: password - name: Import external ova template ovirt.ovirt.ovirt_template: cluster: golden_env_mixed_1 name: Bla state: present timeout: 1800 poll_interval: 30 kvm: host: host_mixed_1 url: ova:///tmp/Bla.ova storage_domain: nfs_0 auth: "{{ovirt_auth}}" collections: - ovirt.ovirt TASK [Import external ova template] ******************************************** 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 "[Internal Engine Error]". HTTP response code is 400. fatal: [localhost]: FAILED! => {"changed": false, "msg": "Fault reason is \"Operation Failed\". Fault detail is \"[Internal Engine Error]\". HTTP response code is 400."} In engine.log: 2022-05-09 17:38:30,449+03 ERROR [org.ovirt.engine.core.common.utils.ansible.AnsibleExecutor] (default task-85) [286921d1-a776-455d-b469-374c22eb340f] Exception: Permission denied 2022-05-09 17:38:30,449+03 ERROR [org.ovirt.engine.core.bll.GetVmTemplateFromOvaQuery] (default task-85) [286921d1-a776-455d-b469-374c22eb340f] Query 'GetVmTemplateFromOvaQuery' failed: For input string: "" 2022-05-09 17:38:30,449+03 ERROR [org.ovirt.engine.core.bll.GetVmTemplateFromOvaQuery] (default task-85) [286921d1-a776-455d-b469-374c22eb340f] Exception: java.lang.NumberFormatException: For input string: "" at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.base/java.lang.Integer.parseInt(Integer.java:662) at java.base/java.lang.Integer.valueOf(Integer.java:983) at deployment.engine.ear.bll.jar//org.ovirt.engine.core.common.utils.ansible.AnsibleRunnerHttpClient.getLastEventId(AnsibleRunnerHttpClient.java:117) at deployment.engine.ear.bll.jar//org.ovirt.engine.core.common.utils.ansible.AnsibleExecutor.runCommand(AnsibleExecutor.java:185) at deployment.engine.ear.bll.jar//org.ovirt.engine.core.common.utils.ansible.AnsibleExecutor.runCommand(AnsibleExecutor.java:102) at deployment.engine.ear.bll.jar//org.ovirt.engine.core.common.utils.ansible.AnsibleExecutor.runCommand(AnsibleExecutor.java:94) at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.GetFromOvaQuery.runAnsibleQueryOvaInfoPlaybook(GetFromOvaQuery.java:68) at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.GetFromOvaQuery.executeQueryCommand(GetFromOvaQuery.java:43) ... 2022-05-09 17:38:30,455+03 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-85) [] Operation Failed: [Internal Engine Error] The other error [1] when we tried to export the template as OVA: 2022-05-09 17:27:28,979+03 ERROR [org.ovirt.engine.core.common.utils.ansible.AnsibleExecutor] (default task-82) [3ecfc56e-404c-4384-967a-917023fcbf0a] Exception: Permission denied 2022-05-09 17:27:28,979+03 ERROR [org.ovirt.engine.core.bll.exportimport.ExportVmTemplateToOvaCommand] (default task-82) [3ecfc56e-404c-4384-967a-917023fcbf0a] Error during ValidateFailure.: java.lang.NumberFormatException: For input string: "" at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.base/java.lang.Integer.parseInt(Integer.java:662) at java.base/java.lang.Integer.valueOf(Integer.java:983) at deployment.engine.ear.bll.jar//org.ovirt.engine.core.common.utils.ansible.AnsibleRunnerHttpClient.getLastEventId(AnsibleRunnerHttpClient.java:117) at deployment.engine.ear.bll.jar//org.ovirt.engine.core.common.utils.ansible.AnsibleExecutor.runCommand(AnsibleExecutor.java:185) at deployment.engine.ear.bll.jar//org.ovirt.engine.core.common.utils.ansible.AnsibleExecutor.runCommand(AnsibleExecutor.java:75) at deployment.engine.ear.bll.jar//org.ovirt.engine.core.common.utils.ansible.AnsibleExecutor.runCommand(AnsibleExecutor.java:52) at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.exportimport.ExportOvaCommand.validateTargetFolder(ExportOvaCommand.java:113) at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.exportimport.ExportOvaCommand.validate(ExportOvaCommand.java:90) at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.exportimport.ExportVmTemplateToOvaCommand.validate(ExportVmTemplateToOvaCommand.java:76) ...
Moving to 4.5.1, too late to fix on 4.5.0-1
I was not able to reproduce this issue on engine: 4.5.0.8-1.el8 ovirt-ansible-collection: 2.0.4-1 Could you please try the template import again? Looking at the log looks like an engine/AR issue.
Verified in ovirt-ansible-collection-2.0.4-1.el8ev.noarch, ovirt-engine-4.5.1-0.62.el8ev.noarch
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (RHV Engine and Host Common Packages update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2022:5584
Due to QE capacity, we are not going to cover this issue in our automation