Bug 1537429 - NPE while import V2V with REST only
Summary: NPE while import V2V with REST only
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: BLL.Virt
Version: 4.2.1.2
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ovirt-4.2.2
: ---
Assignee: Arik
QA Contact: Israel Pinto
URL:
Whiteboard:
Depends On:
Blocks: 1049604
TreeView+ depends on / blocked
 
Reported: 2018-01-23 08:15 UTC by Israel Pinto
Modified: 2019-04-28 13:44 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-03-29 11:19:15 UTC
oVirt Team: Virt
Embargoed:
rule-engine: ovirt-4.2+
rule-engine: blocker+
mtessun: planning_ack+
rule-engine: devel_ack+
mavital: testing_ack+


Attachments (Terms of Use)
Events - Failed to import (40.40 KB, image/png)
2018-01-23 08:15 UTC, Israel Pinto
no flags Details
engine_logs (530.59 KB, application/x-xz)
2018-01-23 08:19 UTC, Israel Pinto
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 86689 0 master MERGED core: fix import of external vms as clones 2018-01-24 10:00:24 UTC

Description Israel Pinto 2018-01-23 08:15:57 UTC
Created attachment 1384729 [details]
Events - Failed to import

Description of problem:
Failed to import from external provider (vmware/kvm/ova file) 
with REST API.

From the UI the imports works fine.

Version-Release number of selected component (if applicable):
Engine Version:4.2.1.2-0.1.el7
Host:
OS Version: RHEL - 7.4 - 18.el7
Kernel Version:3.10.0 - 693.17.1.el7.x86_64
KVM Version:2.9.0 - 16.el7_4.14
LIBVIRT Version:libvirt-3.2.0-14.el7_4.7
VDSM Version:vdsm-4.20.14-1.el7ev
SPICE Version:0.12.8 - 2.el7.1
Kernel Features: PTI: 1, IBPB: 0, IBRS: 0

How reproducible:
100%

Steps to Reproduce:
Import vm from external provider (vmware/kvm/ova) with REST

Actual results:
All imports failed.

Expected results:


Additional info:

2018-01-23 09:58:03,584+02 INFO  [org.ovirt.engine.core.bll.exportimport.ImportVmFromExternalProviderCommand] (default task-22) [3f9042ec] Lock Acquired to object 'EngineLock:{exclusiveLocks='[3925fa13-59d4-4e99-a4b2-a0ffae4c9890=VM, test_v2v_rhel_7_2_automation_kvm=VM_NAME]', sharedLocks=''}'
NPE:
2018-01-23 09:58:03,759+02 INFO  [org.ovirt.engine.core.bll.exportimport.ImportVmFromExternalProviderCommand] (default task-22) [] Running command: ImportVmFromExternalProviderCommand internal: true. Entities affected :  ID: 239f4c0f-92cd-453a-8b51-b38bcc17bba1 Type: StorageAction group IMPORT_EXPORT_VM with role type ADMIN
2018-01-23 09:58:03,805+02 ERROR [org.ovirt.engine.core.bll.exportimport.ImportVmFromExternalProviderCommand] (default task-22) [] Command 'org.ovirt.engine.core.bll.exportimport.ImportVmFromExternalProviderCommand' failed: null
2018-01-23 09:58:03,806+02 ERROR [org.ovirt.engine.core.bll.exportimport.ImportVmFromExternalProviderCommand] (default task-22) [] Exception: java.lang.NullPointerException
        at org.ovirt.engine.core.bll.exportimport.ImportVmFromExternalProviderCommand.buildAddDiskParameters(ImportVmFromExternalProviderCommand.java:324) [bll.jar:]
        at org.ovirt.engine.core.bll.exportimport.ImportVmFromExternalProviderCommand.createDisk(ImportVmFromExternalProviderCommand.java:302) [bll.jar:]
        at org.ovirt.engine.core.bll.exportimport.ImportVmFromExternalProviderCommand.processImages(ImportVmFromExternalProviderCommand.java:265) [bll.jar:]
        at org.ovirt.engine.core.bll.exportimport.ImportVmCommandBase.executeVmCommand(ImportVmCommandBase.java:476) [bll.jar:]
        at org.ovirt.engine.core.bll.VmCommand.executeCommand(VmCommand.java:161) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeWithoutTransaction(CommandBase.java:1133) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeActionInTransactionScope(CommandBase.java:1275) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.runInTransaction(CommandBase.java:1924) [bll.jar:]
        at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInSuppressed(TransactionSupport.java:164) [utils.jar:]
        at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope(TransactionSupport.java:103) [utils.jar:]
        at org.ovirt.engine.core.bll.CommandBase.execute(CommandBase.java:1335) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeAction(CommandBase.java:400) [bll.jar:]
        at org.ovirt.engine.core.bll.executor.DefaultBackendActionExecutor.execute(DefaultBackendActionExecutor.java:13) [bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runAction(Backend.java:468) [bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runActionImpl(Backend.java:450) [bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runInternalAction(Backend.java:656) [bll.jar:]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_151]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_151]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_151]
        at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_151]
        at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
        at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:509)
        at org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.delegateInterception(Jsr299BindingsInterceptor.java:78)
        at org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:88)

Comment 1 Israel Pinto 2018-01-23 08:19:28 UTC
Created attachment 1384731 [details]
engine_logs

Comment 2 Israel Pinto 2018-01-23 08:20:28 UTC
automation test with import from vmware/kvm/ova 
https://rhv-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/rhv-4.2-ge-runner-compute/385/

Comment 3 Arik 2018-01-23 08:55:58 UTC
Sharon, note that when importing from rest-api the VM is created as a new-entity which means it will be assigned with a new ID [1]. Therefore we will not be able to find a DiskVmElement that corresponds to the new ID on the images and we fail with NPE on [2]. So now that DiskVmElements are created while querying the VM, we need to adjust them when the VM is imported as a new entity.

[1] https://github.com/oVirt/ovirt-engine/blob/ovirt-engine-4.2.1.2/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmFromExternalUrlCommand.java#L130
[2] https://github.com/oVirt/ovirt-engine/blob/ovirt-engine-4.2.1.2/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmFromExternalProviderCommand.java#L324

Comment 6 Israel Pinto 2018-02-18 12:03:08 UTC
Verify with:
Engine Software Version:4.2.1.6-0.1.el7
Host:
OS Version:RHEL - 7.5 - 6.el7
Kernel Version:3.10.0 - 851.el7.x86_64
KVM Version:2.9.0 - 16.el7_4.13.1
LIBVIRT Version:libvirt-3.9.0-13.el7
VDSM Version:vdsm-4.20.18-1.el7ev

Steps:
Export ova and import it 

Results:
OVA imported successfully

Comment 7 Sandro Bonazzola 2018-03-29 11:19:15 UTC
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.2 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.