Bug 1704647 - Cannot import OVA as template (Failed to query OVA info)
Summary: Cannot import OVA as template (Failed to query OVA info)
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: BLL.Virt
Version: 4.3.1
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ovirt-4.3.5
: 4.3.5.2
Assignee: Steven Rosenberg
QA Contact: Nisim Simsolo
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-04-30 09:11 UTC by Nisim Simsolo
Modified: 2019-07-30 14:08 UTC (History)
8 users (show)

Fixed In Version: ovirt-engine-4.3.5.2
Doc Type: Enhancement
Doc Text:
Feature: When attempting to import OVA files as a Template when only one or more VM OVA files exists and no Template OVA files exist, the Import gave an error message that the Import failed to load the OVA file from the directory. It was not clear that the failure was due to failing to find a compatible OVA file in the directory. The wording of the message was therefore modified so that it was clearer to the user. Reason: Users felt the message was confusing. Result: The message now reports that the process failed to find or load the OVA file which covers both scenarios.
Clone Of:
Environment:
Last Closed: 2019-07-30 14:08:34 UTC
oVirt Team: Virt
Embargoed:
pm-rhel: ovirt-4.3+
michal.skrivanek: devel_ack+


Attachments (Terms of Use)
engine.log (198.93 KB, text/plain)
2019-05-01 07:06 UTC, Nisim Simsolo
no flags Details
vdsm.log (2.77 MB, text/plain)
2019-05-01 07:06 UTC, Nisim Simsolo
no flags Details
reassigned engine.log (817.06 KB, text/plain)
2019-06-04 11:58 UTC, Nisim Simsolo
no flags Details
reassigned ui.log of WebAdmin uncaught exception (48.98 KB, text/plain)
2019-06-04 11:58 UTC, Nisim Simsolo
no flags Details
reassigned vdsm.log (4.59 MB, text/plain)
2019-06-04 11:59 UTC, Nisim Simsolo
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 99965 0 'None' MERGED engine: Improved Diagnostics for OVA Importing 2020-11-23 21:17:30 UTC
oVirt gerrit 100960 0 'None' MERGED engine: Improved Diagnostics for OVA Importing 2020-11-23 21:17:30 UTC

Description Nisim Simsolo 2019-04-30 09:11:14 UTC
Description of problem:
Trying to import OVA as template failed with engine.log: 
2019-04-30 11:59:37,029+03 ERROR [org.ovirt.engine.core.bll.GetVmTemplateFromOvaQuery] (default task-3) [83db3dfd-cdfb-4b4a-a068-f6700b463627] Query 'GetVmTemplateFromOvaQuery' failed: EngineException: Failed to query OVA info (Failed with error GeneralException and code 100)
2019-04-30 11:59:37,029+03 ERROR [org.ovirt.engine.core.bll.GetVmTemplateFromOvaQuery] (default task-3) [83db3dfd-cdfb-4b4a-a068-f6700b463627] Exception: org.ovirt.engine.core.common.errors.EngineException: EngineException: Failed to query OVA info (Failed with error GeneralException and code 100)

Importing OVA to VM (using the same OVA path) is possible.

Version-Release number of selected component (if applicable):
ovirt-engine-4.3.3.6-0.1.el7
vdsm-4.30.13-1.el7ev.x86_64
libvirt-4.5.0-10.el7_6.7.x86_64
qemu-kvm-rhev-2.12.0-18.el7_6.4.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Browse WebAdmin -> Compute -> templates -> import
2. Select OVA as source, add OVA folder path and click " load" button.
3.

Actual results:
In WebAdmin, query retrieves nothing and the next message appears: " Failed to load VM configuration from OVA file: /home/nisim/rhv_ova/"
In engine.log there's a failure GeneralException and code 100.

Expected results:
It should be possible to import OVA to template.

Additional info:
Issue is also relevant for upstream.
engine.log and vdsm.log attached.

Comment 1 Ryan Barry 2019-05-01 00:49:58 UTC
I don't see the attachments. Missing?

Comment 2 Nisim Simsolo 2019-05-01 07:06:24 UTC
Created attachment 1560665 [details]
engine.log

Comment 3 Nisim Simsolo 2019-05-01 07:06:47 UTC
Created attachment 1560666 [details]
vdsm.log

Comment 4 Nisim Simsolo 2019-05-01 07:07:55 UTC
attached now. please see engine.log error occurs at 2019-05-01 10:02:25,770+03

Comment 5 Steven Rosenberg 2019-05-06 16:43:30 UTC
I tested this. When I export a VM as an OVA file, it does import successfully as a VM, but fails with the same error as per this issue when attempting to import as a template.

If one exports a template as an OVA and then imports the OVA file as a template it succeeds.

In debugging the code when importing an OVA, the message sent via the ansible playbook ovirt-ova-query.yml has the entity_type = vm for a VM, but with a template, the entity_type is template.

The entity_type is the only real differences between the two messages.

Alternatively, if one attempts to import a template OVA file as a VM, then the VM import fails the same way.

It seems that VM OVA files need to be imported as VMs and template OVA files need to be imported as templates.

Please retest and verify that this is the case.

Comment 6 Nisim Simsolo 2019-05-07 07:19:45 UTC
It is.
But, according to https://gerrit.ovirt.org/#/c/92531/ there should be a differentiation between VM OVA  and template OVA
so it won't be possible to import template OVA from VMs -> OVA import dialog or import VM OVA file from templates -> OVA import dialog.

Comment 7 Steven Rosenberg 2019-05-07 07:54:19 UTC
(In reply to Nisim Simsolo from comment #6)
> It is.
> But, according to https://gerrit.ovirt.org/#/c/92531/ there should be a
> differentiation between VM OVA  and template OVA
> so it won't be possible to import template OVA from VMs -> OVA import dialog
> or import VM OVA file from templates -> OVA import dialog.

Yes, so that it is point. I only simulate the error you have when I am importing a VM ova as a template as per your description. So please verify that the ova you are importing is a VM ova and if so, then of cause it is not supported for Template OVA importing.

Importing a Template OVA exported as a Template OVA worked fine for me as per my description.

Comment 8 Nisim Simsolo 2019-05-07 08:02:11 UTC
You are correct, importing template OVA from templated dialog is working as expected. but we shouldn't see VM OVA under templates OVA import dialog.

Comment 9 Steven Rosenberg 2019-05-07 08:08:56 UTC
(In reply to Nisim Simsolo from comment #8)
> You are correct, importing template OVA from templated dialog is working as
> expected. but we shouldn't see VM OVA under templates OVA import dialog.

So that is not a defect, but new development request? Or was this a regression and if so in which version did it have the VM OVA under Templates OVA import dialog?

Comment 10 Nisim Simsolo 2019-05-07 08:15:13 UTC
Regression.
ovirt-engine-4.3.3.6-0.1.el7
vdsm-4.30.13-1.el7ev.x86_64
libvirt-4.5.0-10.el7_6.7.x86_64
qemu-kvm-rhev-2.12.0-18.el7_6.4.x86_64

Comment 11 Steven Rosenberg 2019-05-08 16:30:55 UTC
In reviewing the code and further testing, this is not a regression. If we only have one VM OVA file in the ova directory and attempt to import as a template, the program works the same as if the directory was empty as per the functionality before Arik's change when the directory is empty. If one exports an existing Template OVA to the directory and then in the import perform the load, the program will skip over the VM OVA, but return with the Template OVA. 

Therefore changing this would be a redesign.

Please verify by testing both with an empty ova directory and with a Template OVA in the directory with the VM OVA. Please also test an older version (I tested 4.2.7) to see that an empty OVA directory yields the same error.

Comment 15 Nisim Simsolo 2019-06-04 11:45:28 UTC
builds: 
ovirt-engine-4.4.0-0.0.master.20190602135708.gitd0fe1bf.el7
vdsm-4.40.0-310.gitbf1f64f.el7.x86_64
libvirt-4.5.0-10.el7_6.10.x86_64
qemu-kvm-ev-2.12.0-18.el7_6.5.1.x86_64

Reassigning reason:
template OVA and VM OVA import dialogs are still behaving incorrectly in some cases:

1. Trying to load template OVA by setting folder from VM OVA import dialog:
WebAdmin import dialog failed with message: Failed to find or load the VM or Template configuration from OVA directory and/or file: /home/nisim/ova_templates/
the next ERROR is logged in engine.log:
2019-06-04 14:06:40,506+03 ERROR [org.ovirt.engine.core.bll.GetVmFromOvaQuery] (default task-17) [6bbdc019-9b86-48af-ae3f-c861f768f46a] Exception: org.ovirt.engine.core.common.errors.EngineException: EngineException: Fai
led to query OVA info (Failed with error GeneralException and code 100)

2. Setting specific template OVA file (for example:  /home/nisim/ova_templates/centos44_temp.ovafrom ) in VM OVA import dialog:
.ova file is listed as available for Download.
Downloading template OVA failed with engine.log:
2019-06-04 14:09:32,572+03 ERROR [org.ovirt.engine.core.bll.exportimport.ImportVmFromOvaCommand] (EE-ManagedThreadFactory-engine-Thread-23425) [3c1200c2-b849-4bac-8554-138044661060] Command 'org.ovirt.engine.core.bll.exportimport.ImportVmFromOvaCommand' failed: CallableStatementCallback; SQL [{call insertvmstatic(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}ERROR: duplicate key value violates unique constraint "pk_vm_static"

3. using mixed folder of VM OVAs and template OVAs in VM OVA import dialog is showing only VM OVA files. which is the expected behavior.

4. Trying to load single VM OVA folder from templates OVA import dialog:
WebAdmin import dialog failed with message: Failed to find or load the VM or Template configuration from OVA directory and/or file: /home/nisim/one_ova_file
2019-06-04 14:22:48,319+03 ERROR [org.ovirt.engine.core.bll.GetVmTemplateFromOvaQuery] (default task-20) [5aac8441-f669-4764-909c-cfb2aa528f10] Exception: org.ovirt.engine.core.common.errors.EngineException: EngineExcept
ion: Failed to query OVA info (Failed with error GeneralException and code 100)

this behavior is also true for folder with many VM OVA files.

5. Setting specific VM OVA file (for example: /home/nisim/rhv_ova/centos44.ova) in templates import OVA dialog :
WebAdmin uncaught exception occurred.
from engine ui.log:
2019-06-04 14:25:58,504+03 ERROR [org.ovirt.engine.ui.frontend.server.gwt.OvirtRemoteLoggingService] (default task-20) [] Permutation name: 67045B74D8336947E7409A3559FC441A
2019-06-04 14:25:58,505+03 ERROR [org.ovirt.engine.ui.frontend.server.gwt.OvirtRemoteLoggingService] (default task-20) [] Uncaught exception: com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read property 'ob' of null

6. Using mixed folder of VM OVAs and template OVAs in templates OVA import dialog is showing only OVA of templates. which is the expected behavior.

Comment 16 Nisim Simsolo 2019-06-04 11:58:25 UTC
Created attachment 1577036 [details]
reassigned engine.log

Comment 17 Nisim Simsolo 2019-06-04 11:58:58 UTC
Created attachment 1577037 [details]
reassigned ui.log of WebAdmin uncaught exception

Comment 18 Nisim Simsolo 2019-06-04 11:59:32 UTC
Created attachment 1577038 [details]
reassigned vdsm.log

Comment 19 Steven Rosenberg 2019-06-04 15:42:32 UTC
(In reply to Nisim Simsolo from comment #15)
> builds: 
> ovirt-engine-4.4.0-0.0.master.20190602135708.gitd0fe1bf.el7
> vdsm-4.40.0-310.gitbf1f64f.el7.x86_64
> libvirt-4.5.0-10.el7_6.10.x86_64
> qemu-kvm-ev-2.12.0-18.el7_6.5.1.x86_64
> 
> Reassigning reason:
> template OVA and VM OVA import dialogs are still behaving incorrectly in
> some cases:
> 
> 1. Trying to load template OVA by setting folder from VM OVA import dialog:
> WebAdmin import dialog failed with message: Failed to find or load the VM or
> Template configuration from OVA directory and/or file:
> /home/nisim/ova_templates/
> the next ERROR is logged in engine.log:
> 2019-06-04 14:06:40,506+03 ERROR
> [org.ovirt.engine.core.bll.GetVmFromOvaQuery] (default task-17)
> [6bbdc019-9b86-48af-ae3f-c861f768f46a] Exception:
> org.ovirt.engine.core.common.errors.EngineException: EngineException: Fai
> led to query OVA info (Failed with error GeneralException and code 100)
> 
> 2. Setting specific template OVA file (for example: 
> /home/nisim/ova_templates/centos44_temp.ovafrom ) in VM OVA import dialog:
> .ova file is listed as available for Download.
> Downloading template OVA failed with engine.log:
> 2019-06-04 14:09:32,572+03 ERROR
> [org.ovirt.engine.core.bll.exportimport.ImportVmFromOvaCommand]
> (EE-ManagedThreadFactory-engine-Thread-23425)
> [3c1200c2-b849-4bac-8554-138044661060] Command
> 'org.ovirt.engine.core.bll.exportimport.ImportVmFromOvaCommand' failed:
> CallableStatementCallback; SQL [{call insertvmstatic(?, ?, ?, ?, ?, ?, ?, ?,
> ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
> ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
> ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}ERROR: duplicate key value
> violates unique constraint "pk_vm_static"
> 
> 3. using mixed folder of VM OVAs and template OVAs in VM OVA import dialog
> is showing only VM OVA files. which is the expected behavior.
> 
> 4. Trying to load single VM OVA folder from templates OVA import dialog:
> WebAdmin import dialog failed with message: Failed to find or load the VM or
> Template configuration from OVA directory and/or file:
> /home/nisim/one_ova_file
> 2019-06-04 14:22:48,319+03 ERROR
> [org.ovirt.engine.core.bll.GetVmTemplateFromOvaQuery] (default task-20)
> [5aac8441-f669-4764-909c-cfb2aa528f10] Exception:
> org.ovirt.engine.core.common.errors.EngineException: EngineExcept
> ion: Failed to query OVA info (Failed with error GeneralException and code
> 100)
> 
> this behavior is also true for folder with many VM OVA files.
> 
> 5. Setting specific VM OVA file (for example:
> /home/nisim/rhv_ova/centos44.ova) in templates import OVA dialog :
> WebAdmin uncaught exception occurred.
> from engine ui.log:
> 2019-06-04 14:25:58,504+03 ERROR
> [org.ovirt.engine.ui.frontend.server.gwt.OvirtRemoteLoggingService] (default
> task-20) [] Permutation name: 67045B74D8336947E7409A3559FC441A
> 2019-06-04 14:25:58,505+03 ERROR
> [org.ovirt.engine.ui.frontend.server.gwt.OvirtRemoteLoggingService] (default
> task-20) [] Uncaught exception:
> com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read
> property 'ob' of null
> 
> 6. Using mixed folder of VM OVAs and template OVAs in templates OVA import
> dialog is showing only OVA of templates. which is the expected behavior.

As per previous comments, we do not support mixing so one cannot import a Template as a VM, nor can one import a VM as a Template. 

So we will obtain the exception if:

1. The OVA directory is empty for either importing VMs or Templates.
2. The OVA directory only has Templates and we are importing VMs (after filtering the Templates there are no files to import so it considers it an empty directory).
3. The OVA directory only has VMs and we are importing Templates (after filtering the VMS there are no files to import so it considers it an empty directory).

This covers tests 1, 3, 4, and 6. So all are expected behavior. Tests 2 and 5 are not really supported, because as the dialog states the the Text box expects a "File Path" not a file name. We are only supporting folders here, not files.

The only real issue here is handling these scenarios more gracefully, but that should not be high priority nor a simple bug fix, but new development work involving infrastructure changes. We agreed to just change the wording of the message and this is what is reflected in the logs and tested.

Therefore all that was changed was the wording of the message and one can see this in the message "Failed to find or load the VM or Template configuration from OVA directory and/or file".

The exception is just the mechanism that unwinds the stack when handling the scenario.

The question is whether we want to spend the time redesigning the functionality.

Comment 20 Steven Rosenberg 2019-06-23 11:46:14 UTC
As per Tal's comment on: https://gerrit.ovirt.org/#/c/100960/ 

"Please clone the bug to downstream and use the new Bug-Url in the commit message"

Tal states it is a manager/team lead process.

Comment 21 Michal Skrivanek 2019-06-23 13:58:19 UTC
No need

Comment 22 Ryan Barry 2019-06-23 14:33:01 UTC
(In reply to Steven Rosenberg from comment #20)
> As per Tal's comment on: https://gerrit.ovirt.org/#/c/100960/ 
> 
> "Please clone the bug to downstream and use the new Bug-Url in the commit
> message"
> 
> Tal states it is a manager/team lead process.

To clarify, no customer case, no need for a d/s clone

Comment 23 Nisim Simsolo 2019-07-03 09:11:51 UTC
Verified:
rhvm-4.3.5.2-0.1.el7
vdsm-4.30.22-1.el7ev.x86_64
virt-v2v-1.40.2-5.el7.x86_64
libvirt-4.5.0-23.el7.x86_64
qemu-kvm-rhev-2.12.0-33.el7.x86_64

Verification scenario: 
Polarion test case added to external trackers

Comment 24 Sandro Bonazzola 2019-07-30 14:08:34 UTC
This bugzilla is included in oVirt 4.3.5 release, published on July 30th 2019.

Since the problem described in this bug report should be
resolved in oVirt 4.3.5 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


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