Bug 2074916

Summary: Failed to upload OVA as template via upload_ova_as_vm_or_template.py
Product: [oVirt] ovirt-engine Reporter: Qin Yuan <qiyuan>
Component: GeneralAssignee: Arik <ahadas>
Status: CLOSED CURRENTRELEASE QA Contact: Qin Yuan <qiyuan>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.5.0CC: ahadas, bugs, lsvaty, michal.skrivanek
Target Milestone: ovirt-4.5.0-1Keywords: Automation, Regression
Target Release: 4.5.0.5Flags: sbonazzo: ovirt-4.5+
michal.skrivanek: blocker-
sbonazzo: exception+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.5.0.5 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-03 06:46:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
engine.log none

Description Qin Yuan 2022-04-13 10:05:26 UTC
Created attachment 1872126 [details]
engine.log

Description of problem:
Failed to upload OVA as template via upload_ova_as_vm_or_template.py, see error below:

# python3 /usr/share/doc/python3-ovirt-engine-sdk4/examples/upload_ova_as_vm_or_template.py --template /root/testnew.ova -c CONFIG --sd-name nfs_0 --cluster-name golden_env_mixed_1
[   0.3 ] Checking image...
[   0.3 ] Image format: qcow2
[   0.3 ] Disk name: de83b8d6-60db-4044-b86d-57f7f87fce63.qcow2
[   0.3 ] Disk format: cow
[   0.3 ] Disk provisioned size: 10737418240
[   0.3 ] Disk initial size: 3599630336
[   0.3 ] Disk backup: None
[   0.3 ] Creating disk...
[   9.1 ] Disk ID: 9e4dd60e-abc8-4de6-b0e9-11a7c4979a39
[   9.1 ] Creating image transfer...
[  10.6 ] Transfer ID: 1b01c080-97b2-4b1c-8aa2-d4ee91f5107d
[  10.6 ] Transfer host name: host_mixed_1
[  10.6 ] Uploading disk de83b8d6-60db-4044-b86d-57f7f87fce63 from testnew.ova...
[ 100.00% ] 10.00 GiB, 32.66 seconds, 313.55 MiB/s                             
[  43.3 ] Finalizing image transfer...
[  46.3 ] Upload completed successfully
[  46.3 ] Adding template testnew
Traceback (most recent call last):
  File "/usr/share/doc/python3-ovirt-engine-sdk4/examples/upload_ova_as_vm_or_template.py", line 250, in <module>
    data=ovf_str.decode("utf-8")
  File "/usr/lib64/python3.6/site-packages/ovirtsdk4/services.py", line 30673, in add
    return self._internal_add(template, headers, query, wait)
  File "/usr/lib64/python3.6/site-packages/ovirtsdk4/service.py", line 232, in _internal_add
    return future.wait() if wait else future
  File "/usr/lib64/python3.6/site-packages/ovirtsdk4/service.py", line 55, in wait
    return self._code(response)
  File "/usr/lib64/python3.6/site-packages/ovirtsdk4/service.py", line 229, in callback
    self._check_fault(response)
  File "/usr/lib64/python3.6/site-packages/ovirtsdk4/service.py", line 132, in _check_fault
    self._raise_error(response, body)
  File "/usr/lib64/python3.6/site-packages/ovirtsdk4/service.py", line 118, in _raise_error
    raise error
ovirtsdk4.Error: Fault reason is "Operation Failed". Fault detail is "[Internal Engine Error]". HTTP response code is 400.

In engine.log:

2022-04-13 10:57:24,455+03 ERROR [org.ovirt.engine.core.bll.exportimport.ImportVmTemplateFromConfigurationCommand] (default task-6) [60faf8a3-5148-440c-a97e-7ccd1397e1fd] Exception: java.lang.NullPointerException
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.exportimport.ImportVmTemplateCommand.initImportClonedTemplateDisks(ImportVmTemplateCommand.java:162)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.exportimport.ImportVmTemplateCommandBase.lambda$executeCommand$6(ImportVmTemplateCommandBase.java:330)
        at org.ovirt.engine.core.utils//org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction(TransactionSupport.java:181)
        at deployment.engine.ear.bll.jar//org.ovirt.engine.core.bll.exportimport.ImportVmTemplateCommandBase.executeCommand(ImportVmTemplateCommandBase.java:328)
...


Version-Release number of selected component (if applicable):
python3-ovirt-engine-sdk4-4.5.0-1.el8ev.x86_64
ovirt-engine-4.5.0-0.237.el8ev.noarch

How reproducible:
100%

Steps to Reproduce:
1. Create a VM(from template latest-rhel-guest-image-8.6-infra)
2. Export the VM as OVA
3. Remove the VM on engine
4. Go to the host that holds the OVA file, upload the OVA as template with the above command

Actual results:
1. Failed to upload OVA as template with the errors above

Expected results:
1. Upload OVA as template via upload_ova_as_vm_or_template.py should succeed.

Additional info:

Comment 1 Arik 2022-04-19 15:09:09 UTC
Seems to be a regression that was caused by the fix for bz 2043124

Comment 2 RHEL Program Management 2022-04-19 15:09:16 UTC
This bug report has Keywords: Regression or TestBlocker.
Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.

Comment 3 Michal Skrivanek 2022-04-19 16:45:43 UTC
is there any other impact than on sdk example? doesn't look like a GA blocker.

Comment 4 Arik 2022-04-19 20:57:11 UTC
I'm not sure that I understand the question - you mean whether it's something specific to the script? if so then no, it's functionality that is exposed via the API and other clients that use it can be impacted as well

Comment 8 Qin Yuan 2022-04-28 13:24:30 UTC
Verified with:
ovirt-engine-4.5.0.5-0.7.el8ev.noarch
python3-ovirt-engine-sdk4-4.5.1-1.el8ev.x86_64

Steps:
1. Create a VM(from template latest-rhel-guest-image-8.6-infra)
2. Export the VM as OVA
3. Remove the VM on engine
4. Go to the host that holds the OVA file, upload the OVA as template using upload_ova_as_vm_or_template.py
5. Create VM from the uploaded template
6. Run/migrate/stop the VM


Results:
1. Uploading OVA as template via upload_ova_as_vm_or_template.py succeeds.
2. Creating VM from the uploaded template succeeds.
3. Running/migrating/stopping the VM succeeds.