Bug 1411080

Summary: template creation from a VM with direct lun disk fails with NPE @ storage.DiskVmElementValidator.getDiskId(
Product: [oVirt] ovirt-engine Reporter: Avihai <aefrat>
Component: BLL.StorageAssignee: Tal Nisan <tnisan>
Status: CLOSED DUPLICATE QA Contact: Raz Tamir <ratamir>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.1.0CC: bugs
Target Milestone: ovirt-4.1.0-betaKeywords: Regression
Target Release: ---Flags: tnisan: ovirt-4.1?
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-09 10:19:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
engine & vdsm logs none

Description Avihai 2017-01-08 09:10:09 UTC
Created attachment 1238323 [details]
engine & vdsm logs

Description of problem:
template creation from a VM with direct lun disk  fails with Error during ValidateFailure.: java.lang.NullPointerException

Version-Release number of selected component (if applicable):
oVirt Engine Version: 4.1.0-0.4.master.20170105161132.gitf4e2c11.el7.centos

How reproducible:
100%

Steps to Reproduce:
1.create VM with a bootable disk ( VM in down state)
2.create a direct lun disk (type virtio_scsi)  
3.attach direct lun disk to VM .
4.create a template from the VM 

Actual results:
creation fails with the following engine error:

2017-01-08 10:49:58,265+02 ERROR [org.ovirt.engine.core.bll.AddVmTemplateCommand] (default task-6) [a6489eca-f064-4350-b5fd-4f1a29baeac6] Error during ValidateFailure.: java.lang.NullPointerException


Expected results:
No error should occur.


Additional info:
This was tested both with GUI & REST API.

10 first lines of Engine Error (the rest is in the  engine log file) :

2017-01-08 10:33:08,040+02 ERROR [org.ovirt.engine.core.bll.AddVmTemplateCommand] (default task-16) [templates_create_dcc81d23-8cf4-4f00] Error during ValidateFailure.: java.lang.NullPointerException
        at org.ovirt.engine.core.bll.validator.storage.DiskVmElementValidator.getDiskId(DiskVmElementValidator.java:31) [bll.jar:]
        at org.ovirt.engine.core.bll.validator.storage.MultipleDiskVmElementValidator.lambda$isPassDiscardSupportedForDestSds$2(MultipleDiskVmElementValidator.java:48) [bll.jar:]
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) [rt.jar:1.8.0_111]
        at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1351) [rt.jar:1.8.0_111]
        at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) [rt.jar:1.8.0_111]
        at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) [rt.jar:1.8.0_111]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) [rt.jar:1.8.0_111]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) [rt.jar:1.8.0_111]
        at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) [rt.jar:1.8.0_111]

*API request:

1) Header:
name -> Content-Type
Value -> application/xml

2) Body
<template>
    <name>templ_type_08101100</name>
    <cluster id="a542c251-9856-4adf-88f6-9f2855424056"/>
    <vm id="1ea6c2be-d71e-42f6-8bcc-bf96ee9440aa"/>
</template>

3) Response:

    Status Code: 500 Internal Server Error
    Connection: close
    Content-Encoding: gzip
    Content-Length: 150
    Content-Type: application/xml
    Correlation-Id: a6489eca-f064-4350-b5fd-4f1a29baeac6
    Date: Sun, 08 Jan 2017 08:49:58 GMT
    Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips

Comment 1 Yaniv Kaul 2017-01-08 09:18:43 UTC
Related or dup of bug 1409995 ?

Comment 2 Tal Nisan 2017-01-09 10:19:21 UTC
Couldn't reproduce after the fix for bug 1409995, reverted the fix to verify that it reproduces and confirmed that this is a duplicate indeed

*** This bug has been marked as a duplicate of bug 1409995 ***