Bug 906360 - [rest-api] created direct lun has missing values in db
[rest-api] created direct lun has missing values in db
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi (Show other bugs)
3.2.0
x86_64 Linux
unspecified Severity urgent
: ---
: 3.2.0
Assigned To: Liron Aravot
Katarzyna Jachim
storage
: Regression, TestBlocker
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-31 08:56 EST by Jakub Libosvar
Modified: 2016-02-10 14:19 EST (History)
12 users (show)

See Also:
Fixed In Version: sf10
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Storage
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
engine.log (44.84 KB, text/x-log)
2013-01-31 08:56 EST, Jakub Libosvar
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 10630 None None None Never
oVirt gerrit 11807 None None None Never

  None (edit)
Description Jakub Libosvar 2013-01-31 08:56:14 EST
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
Comment 2 Liron Aravot 2013-02-06 07:33:20 EST
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.
Comment 3 Liron Aravot 2013-02-06 08:15:01 EST
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.
Comment 4 Katarzyna Jachim 2013-04-08 06:11:07 EDT
Verified manually on 3.2.0-10.17.master.el6ev that adding disks with REST API works correctly.
Comment 5 Itamar Heim 2013-06-11 05:07:53 EDT
3.2 has been released
Comment 6 Itamar Heim 2013-06-11 05:07:53 EDT
3.2 has been released
Comment 7 Itamar Heim 2013-06-11 05:07:54 EDT
3.2 has been released
Comment 8 Itamar Heim 2013-06-11 05:36:29 EDT
3.2 has been released

Note You need to log in before you can comment on or make changes to this bug.