Bug 1005773

Summary: NPE when attaching an existing iscsi storage connection to a storage domain
Product: Red Hat Enterprise Virtualization Manager Reporter: Katarzyna Jachim <kjachim>
Component: ovirt-engine-restapiAssignee: Daniel Erez <derez>
Status: CLOSED NOTABUG QA Contact: Elena <edolinin>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.3.0CC: abaron, acanan, acathrow, iheim, kjachim, mpastern, ncredi, oramraz, Rhev-m-bugs, srevivo, yeylon
Target Milestone: ---Keywords: Triaged
Target Release: 3.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-23 13:19:29 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:
Attachments:
Description Flags
engine.log + server.log none

Description Katarzyna Jachim 2013-09-09 11:43:20 UTC
Created attachment 795586 [details]
engine.log + server.log

Description of problem:
I have a storage domain and a storage connection. I try to attach the storage connection to the storage domain using following REST API call:

https://kj-rh33.rhev.lab.eng.brq.redhat.com/api/storagedomains/6c4915f7-dfcb-4f41-b43e-744c45ef8206

<storage_domain id="6c4915f7-dfcb-4f41-b43e-744c45ef8206">
    <storage id="b31edb88-2d62-4f21-85ca-5f36e917fa60"/>
</storage_domain>

It fails with null pointer exception in server.log:
2013-09-09 11:30:00,665 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/api].[org.ovirt.engine.api.restapi.BackendApplication]] (ajp-/127.0.0.1:8702-6) JBWEB000236: Servlet.service() for servlet org.ovirt.engine.api.restapi.BackendApplication threw exception: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
        at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365) [resteasy-jaxrs.jar:2.3.6.Final-redhat-1]
        at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233) [resteasy-jaxrs.jar:2.3.6.Final-redhat-1]
        at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209) [resteasy-jaxrs.jar:2.3.6.Final-redhat-1]
        at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557) [resteasy-jaxrs.jar:2.3.6.Final-redhat-1]
...

I also tried following XML body:

<storage_domain id="6c4915f7-dfcb-4f41-b43e-744c45ef8206">
    <storage_connection id="b31edb88-2d62-4f21-85ca-5f36e917fa60"/>
</storage_domain>

the response was the same

Version-Release number of selected component (if applicable): is13


How reproducible: 100%


Steps to Reproduce:
1. add an iscsi storage domain
2. add an iscsi connection
3. try to attach the connection to the storage domain

Actual results: 
action fails with null pointer exception in server.log

Expected results:
action should succeed

Additional info:

Comment 1 Daniel Erez 2013-09-23 12:42:13 UTC
Attaching a connection to a storage domain is done through storageconnections resource. I.e.:

POST /api/storagedomains/{storage_id}/storageconnections
  <storage_connection id="{connection_id}">
  </storage_connection>

Katarzyna, can you please try the described scenario again using this above api?