Created attachment 690914[details]
engine.log
Description of problem:
Lun was created by sending POST to api/disks with body
<disk>
<alias>direct_lun</alias>
<interface>virtio</interface>
<format>cow</format>
<lun_storage>
<type>iscsi</type>
<logical_unit id="360014055ff2afd2a4474cc2b44d65b0e">
<address>10.35.64.81</address>
<port>3260</port>
<target>iqn.2003-01.org.linux-iscsi.lion.x8664:sn.20121002152127.jenkins-vm-01</target>
</logical_unit>
</lun_storage>
</disk>
Obtained response:
<disk href="/api/disks/85887360-4458-4536-9269-a2822b722cd9" id="85887360-4458-4536-9269-a2822b722cd9">
<name>direct_lun</name>
<link href="/api/disks/85887360-4458-4536-9269-a2822b722cd9/permissions" rel="permissions"/>
<link href="/api/disks/85887360-4458-4536-9269-a2822b722cd9/statistics" rel="statistics"/>
<alias>direct_lun</alias>
<interface>virtio</interface>
<bootable>false</bootable>
<shareable>false</shareable>
<wipe_after_delete>false</wipe_after_delete>
<propagate_errors>false</propagate_errors>
<lun_storage id="360014055ff2afd2a4474cc2b44d65b0e">
<logical_unit id="360014055ff2afd2a4474cc2b44d65b0e">
<size>0</size>
<paths>0</paths>
<disk_id>85887360-4458-4536-9269-a2822b722cd9</disk_id>
</logical_unit>
</lun_storage>
</disk>
Luns table content:
[root@jl-rhevm32 ~]# psql engine postgres -c "select * from luns;"
physical_volume_id | lun_id | volume_group_id | serial
| lun_mapping | vendor_id | product_id | device_size
----------------------------------------+-----------------------------------+----------------------------------------+---------------------------------------
-------------------------+-------------+-----------+------------+-------------
|360014055ff2afd2a4474cc2b44d65b0e | |
| | | | 0
When user wants to remove this lun, it fails and NPE is thrown:
2013-01-31 14:56:32,697 ERROR [org.ovirt.engine.core.bll.RemoveDiskCommand] (ajp-/127.0.0.1:8702-6) [688166c0] Command org.ovirt.engine.core.bll.RemoveDiskCommand throw exception: java.lang.NullPointerException
at org.ovirt.engine.core.bll.storage.StorageHelperBase.removeLun(StorageHelperBase.java:94) [engine-bll.jar:]
at org.ovirt.engine.core.bll.ImagesHandler.removeLunDisk(ImagesHandler.java:695) [engine-bll.jar:]
at org.ovirt.engine.core.bll.RemoveDiskCommand$1.runInTransaction(RemoveDiskCommand.java:297) [engine-bll.jar:]
at org.ovirt.engine.core.bll.RemoveDiskCommand$1.runInTransaction(RemoveDiskCommand.java:294) [engine-bll.jar:]
at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction(TransactionSupport.java:202) [engine-utils.jar:]
at org.ovirt.engine.core.bll.RemoveDiskCommand.removeLunDisk(RemoveDiskCommand.java:294) [engine-bll.jar:]
at org.ovirt.engine.core.bll.RemoveDiskCommand.executeCommand(RemoveDiskCommand.java:289) [engine-bll.jar:]
at org.ovirt.engine.core.bll.CommandBase.executeWithoutTransaction(CommandBase.java:1002) [engine-bll.jar:]
at org.ovirt.engine.core.bll.CommandBase.executeActionInTransactionScope(CommandBase.java:1087) [engine-bll.jar:]
at org.ovirt.engine.core.bll.CommandBase.runInTransaction(CommandBase.java:1468) [engine-bll.jar:]
at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInSuppressed(TransactionSupport.java:166) [engine-utils.jar:]
at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope(TransactionSupport.java:108) [engine-utils.jar:]
at org.ovirt.engine.core.bll.CommandBase.execute(CommandBase.java:1105) [engine-bll.jar:]
at org.ovirt.engine.core.bll.CommandBase.executeAction(CommandBase.java:302) [engine-bll.jar:]
at org.ovirt.engine.core.bll.Backend.runActionImpl(Backend.java:359) [engine-bll.jar:]
at org.ovirt.engine.core.bll.Backend.RunAction(Backend.java:305) [engine-bll.jar:]
at sun.reflect.GeneratedMethodAccessor192.invoke(Unknown Source) [:1.7.0_11-icedtea]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_11-icedtea]
at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_11-icedtea]
Version-Release number of selected component (if applicable):
rhevm-restapi-3.2.0-5.el6ev.noarch
How reproducible:
Always
Steps to Reproduce:
1. Create direct lun via API
2. Remove direct lun
Additional info:
We had similar (same?) issue on 3.1: bug 863101
Backend log attached
http://gerrit.ovirt.org/#/c/10630/
solved by this patch, basically the luns are getting with "" in the volume group id from gui and with null from REST -
this patch solved another issue, but solves this one as well..
will backport it.
forgot to mention - in addition, a db script should be introduced to update previous luns volume group value to avoid the problem from occuring with previously added luns.