Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1275649

Summary: When adding a new direct lun from the REST API, the lun's size appears to be not up to date
Product: [oVirt] ovirt-engine Reporter: Ori Gofen <ogofen>
Component: BLL.StorageAssignee: Idan Shaby <ishaby>
Status: CLOSED CURRENTRELEASE QA Contact: Elad <ebenahar>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.6.0.2CC: acanan, amureini, bugs, ishaby, tnisan, ylavi
Target Milestone: ovirt-3.6.1Flags: rule-engine: ovirt-3.6.z+
ylavi: planning_ack+
rule-engine: devel_ack+
rule-engine: testing_ack+
Target Release: 3.6.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: In case that direct luns are created via the REST API, their size is not queried from vdsm. Consequence: The direct lun is created with default size 0. Fix: If a host id is passed as a parameter, the lun is fetched from vdsm so that its properties are up to date. Note that when the host id was passed as a parameter, we called to vdsm (which is a long operation) also before this patch. The difference is that we didn't use the data we got when creating the lun, we only verified that the host could see it. Thus, this patch doesn't cause the operation to take longer time to execute. Result: The direct lun is created with its real size.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-13 14:37:44 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:
Bug Depends On:    
Bug Blocks: 1275650, 1404389, 1405770    

Description Ori Gofen 2015-10-27 12:31:11 UTC
Description of problem:
When attaching a Direct Lun to a Vm, a new 'disk' object is created and wraps 'Logical_unit' class.
When trying to get it's size using py-sdk, the function returns 'None':

>>> d.get_name()
'vm_Lun_Disk1'
>>> d.get_size()
>>> d.get_provisioned_size()
>>> d.get_provisioned_size()
>>> d.get_actual_size()

This causes dlun disks that have been created using RestApi, to appear with wrong size value (< 1 GB) at the rhevm webadmin's disk tab.

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

How reproducible:
100%

Steps to Reproduce:
1.create a Block Direct Lun

Actual results:
disk.get_actual_size() and disk.get_size() returns None

Expected results:
the right size should be returned when executing a 'Get' request to the href.
(provisioned size should remain 'None')

Additional info:
an additional bug will be opened in order to track the UX part of this bug.

Comment 1 Yaniv Lavi 2015-10-29 12:54:04 UTC
In oVirt testing is done on single release by default. Therefore I'm removing the 4.0 flag. If you think this bug must be tested in 4.0 as well, please re-add the flag. Please note we might not have testing resources to handle the 4.0 clone.

Comment 2 Yaniv Lavi 2015-11-09 12:43:32 UTC
*** Bug 1275650 has been marked as a duplicate of this bug. ***

Comment 3 Allon Mureinik 2015-11-12 13:21:33 UTC
Idan, this bug has a non-trivial (or, at least, non intuitive) fix. Please provide some doctext explaining what this fix does.

Comment 4 Elad 2016-01-10 10:29:44 UTC
LUN size appears as up to date while passing the host in the add disk command. 

Body:

<disk>
   <interface>virtio</interface>
   <lun_storage>
     <type>iscsi</type>
     <host><name>green-vdsa</name></host>
     <logical_unit id="3514f0c5a516008b1">
       <address>10.35.146.129</address>
       <port>3260</port>
       <target>iqn.2008-05.com.xtremio:xio00153500071-514f0c50023f6c00</target>
     </logical_unit>
   </lun_storage>
</disk>


Response:

<disk href= "/api/disks/ea68aaa3-dad5-4eb4-9013-584d9da97f4b" id="ea68aaa3-dad5-4eb4-9013-584d9da97f4b">
<actions>
<link href= "/api/disks/ea68aaa3-dad5-4eb4-9013-584d9da97f4b/export" rel="export"/>
<link href= "/api/disks/ea68aaa3-dad5-4eb4-9013-584d9da97f4b/move" rel="move"/>
<link href= "/api/disks/ea68aaa3-dad5-4eb4-9013-584d9da97f4b/copy" rel="copy"/>
</actions>
<name>_Disk1</name>
<link href= "/api/disks/ea68aaa3-dad5-4eb4-9013-584d9da97f4b/permissions" rel="permissions"/>
<link href= "/api/disks/ea68aaa3-dad5-4eb4-9013-584d9da97f4b/statistics" rel="statistics"/>
<alias>_Disk1</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="3514f0c5a516008b1">
<logical_unit id="3514f0c5a516008b1">
<serial>SXtremIO_XtremApp_XIO00153500071</serial>
<vendor_id>XtremIO</vendor_id>
<product_id>XtremApp</product_id>
<lun_mapping>2</lun_mapping>
<size>21474836480</size>
<paths>0</paths>
<disk_id>ea68aaa3-dad5-4eb4-9013-584d9da97f4b</disk_id>
</logical_unit>
</lun_storage>
<storage_type>lun</storage_type>
</disk>

Used:
rhevm-restapi-3.6.2-0.1.el6.noarch
vdsm-4.17.15-0.el7ev.noarch

Idan, is this sufficient?

Comment 5 Idan Shaby 2016-01-10 12:48:48 UTC
You should also verify that when adding a lun via the rest api:
- With a specified host - you should see its up to date size in the web-admin.
- Without specifying a host - you should see that its size is 0 in the web-admin.

Comment 6 Elad 2016-01-10 12:50:22 UTC
Thanks Idan.
I've tested both scenarios. For both cases, the results are as you mentioned. 

Based on that and on comment #4, moving to VERIFIED.

Comment 7 Sandro Bonazzola 2016-01-13 14:37:44 UTC
oVirt 3.6.1 has been released, closing current release