Bug 1572250 - Disk total size is reported as 0 in disk collection if the disk does not have any snapshots
Summary: Disk total size is reported as 0 in disk collection if the disk does not have...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.2.2.6
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ovirt-4.2.5
: 4.2.5
Assignee: Eyal Shenitzky
QA Contact: Elad
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-26 14:03 UTC by Roman Hodain
Modified: 2018-07-31 15:25 UTC (History)
5 users (show)

Fixed In Version: ovirt-engine-4.2.5
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-07-31 15:25:37 UTC
oVirt Team: Storage
Embargoed:
ylavi: ovirt-4.2+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 92239 0 master MERGED restapi: fix total_size field in disk collection 2020-10-20 11:03:18 UTC
oVirt gerrit 92308 0 ovirt-engine-4.2 MERGED restapi: fix total_size field in disk collection 2020-10-20 11:03:15 UTC

Description Roman Hodain 2018-04-26 14:03:30 UTC
Description of problem:
When getting total_size from a disk that does not have any snapshot. The reported value is 0. 

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

How reproducible:
100%

Steps to Reproduce:
1.Crate VM and one disk
2.get the total_size from the RestAPI

Actual results:
0 in SDK,  not displayed in the API

Expected results:
The total_size should be the same as the actual size. 0 total_size is not logical.

Comment 1 Eyal Shenitzky 2018-05-06 10:58:24 UTC
Hi Roman,

Please add the link/path to the specific collection in the rest-api.
Thanks

Comment 2 Eyal Shenitzky 2018-05-06 11:09:16 UTC
Moreover, 

It seems like you created thin-provision disk that doesn't actually use any byte.
the total_size attribute specifies only the used space, here is the relevant documentation:

" The total size of the disk including all of its snapshots, in bytes.
The total size is the number of bytes actually used by the disk plus the size of its snapshots.
It won't be populated for direct LUN and Cinder disks.
For disks without snapshots the total size is equal to the actual size."

If this is the case, please close this bug as NOTABUG.

Comment 3 Roman Hodain 2018-05-07 14:12:20 UTC
(In reply to Eyal Shenitzky from comment #2)
> Moreover, 
> 
> It seems like you created thin-provision disk that doesn't actually use any
> byte.
> the total_size attribute specifies only the used space, here is the relevant
> documentation:
> 
> " The total size of the disk including all of its snapshots, in bytes.
> The total size is the number of bytes actually used by the disk plus the
> size of its snapshots.
> It won't be populated for direct LUN and Cinder disks.
> For disks without snapshots the total size is equal to the actual size."
> 
> If this is the case, please close this bug as NOTABUG.

In this case, The storage domain is FC so even if there are no changes to the disk the LV is 1GB in size. 


<?xml version="1.0"?>
<disk href="/ovirt-engine/api/disks/3f2fb0c5-d6de-4ded-b380-18f34c5d5a6f" id="3f2fb0c5-d6de-4ded-b380-18f34c5d5a6f">
  <actions>
    <link href="/ovirt-engine/api/disks/3f2fb0c5-d6de-4ded-b380-18f34c5d5a6f/sparsify" rel="sparsify"/>
    <link href="/ovirt-engine/api/disks/3f2fb0c5-d6de-4ded-b380-18f34c5d5a6f/move" rel="move"/>
    <link href="/ovirt-engine/api/disks/3f2fb0c5-d6de-4ded-b380-18f34c5d5a6f/refreshlun" rel="refreshlun"/>
    <link href="/ovirt-engine/api/disks/3f2fb0c5-d6de-4ded-b380-18f34c5d5a6f/copy" rel="copy"/>
    <link href="/ovirt-engine/api/disks/3f2fb0c5-d6de-4ded-b380-18f34c5d5a6f/export" rel="export"/>
  </actions>
  <name>olimpb-test1_Disk1</name>
  <link href="/ovirt-engine/api/disks/3f2fb0c5-d6de-4ded-b380-18f34c5d5a6f/permissions" rel="permissions"/>
  <link href="/ovirt-engine/api/disks/3f2fb0c5-d6de-4ded-b380-18f34c5d5a6f/statistics" rel="statistics"/>
  <actual_size>3355443200</actual_size>
  <alias>olimpb-test1_Disk1</alias>
  <content_type>data</content_type>
  <format>cow</format>
  <image_id>e8162fbb-47cb-4dda-9051-f3f718489bf2</image_id>
  <propagate_errors>false</propagate_errors>
  <provisioned_size>10737418240</provisioned_size>
  <qcow_version>qcow2_v2</qcow_version>
  <shareable>false</shareable>
  <sparse>true</sparse>
  <status>ok</status>
  <storage_type>image</storage_type>
  <total_size>0</total_size>
  <wipe_after_delete>false</wipe_after_delete>
  <storage_domains>
    <storage_domain href="/ovirt-engine/api/storagedomains/26050f66-8486-4974-ba43-bc71b4d9652f" id="26050f66-8486-4974-ba43-bc71b4d9652f"/>
  </storage_domains>
</disk>


lvs -o lv_size,lv_name,lv_tags | grep  3f2fb0c5-d6de-4ded-b380-18f34c5d5a6f
    3.12g e8162fbb-47cb-4dda-9051-f3f718489bf2 IU_3f2fb0c5-d6de-4ded-b380-18f34c5d5a6f,MD_156,PU_00000000-0000-0000-0000-000000000000

Comment 4 Eyal Shenitzky 2018-05-08 13:37:23 UTC
Hey Roman,

I tried to reproduce the bug,
I created a VM with one FC disk (thin and preallocation),
but I see that the actual size seems to reflect the disk size - 

thin-disk:

<name>fc_thin_Disk1</name>
<link href="/ovirt-engine/api/disks/4195b866-4999-4ce8-a665-2a4259a98796/permissions" rel="permissions"/>
<link href="/ovirt-engine/api/disks/4195b866-4999-4ce8-a665-2a4259a98796/statistics" rel="statistics"/>
<actual_size>1073741824</actual_size>
<alias>fc_thin_Disk1</alias>
<content_type>data</content_type>
<format>cow</format>
<image_id>3be091cf-8337-4de3-a056-1a31247caaa2</image_id>
<propagate_errors>false</propagate_errors>
<provisioned_size>3221225472</provisioned_size>
<qcow_version>qcow2_v3</qcow_version>
<shareable>false</shareable>
<sparse>true</sparse>
<status>ok</status>
<storage_type>image</storage_type>
<total_size>1073741824</total_size>
<wipe_after_delete>false</wipe_after_delete>

preallocation disk:

<name>fc_pre_Disk1</name>
<link href="/ovirt-engine/api/disks/667c5f79-fb5a-4171-88ed-e10f2d89be0c/permissions" rel="permissions"/>
<link href="/ovirt-engine/api/disks/667c5f79-fb5a-4171-88ed-e10f2d89be0c/statistics" rel="statistics"/>
<actual_size>3221225472</actual_size>
<alias>fc_pre_Disk1</alias>
<content_type>data</content_type>
<format>raw</format>
<image_id>50d76fc2-7f4f-442a-99b1-09b6d6da0e89</image_id>
<propagate_errors>false</propagate_errors>
<provisioned_size>3221225472</provisioned_size>
<shareable>false</shareable>
<sparse>false</sparse>
<status>ok</status>
<storage_type>image</storage_type>
<total_size>3221225472</total_size>
<wipe_after_delete>false</wipe_after_delete>

Can you reproduce it with other engine/storage?

Comment 5 Roman Hodain 2018-05-25 13:10:46 UTC
I am reopening this bug as I was able to reproduce this issue in a different environment.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>                          
<disk href="/ovirt-engine/api/disks/adfeab7d-0e98-4fa2-a1c5-37401ba524e2" id="adfeab7d-0e98-4fa2-a1c5-37401ba524e2">
    <actions>                                                                    
        <link href="/ovirt-engine/api/disks/adfeab7d-0e98-4fa2-a1c5-37401ba524e2/move" rel="move"/>
        <link href="/ovirt-engine/api/disks/adfeab7d-0e98-4fa2-a1c5-37401ba524e2/refreshlun" rel="refreshlun"/>
        <link href="/ovirt-engine/api/disks/adfeab7d-0e98-4fa2-a1c5-37401ba524e2/copy" rel="copy"/>
        <link href="/ovirt-engine/api/disks/adfeab7d-0e98-4fa2-a1c5-37401ba524e2/export" rel="export"/>
        <link href="/ovirt-engine/api/disks/adfeab7d-0e98-4fa2-a1c5-37401ba524e2/sparsify" rel="sparsify"/>
    </actions>                                                                   
    <name>test04_Disk1</name>                                                    
    <link href="/ovirt-engine/api/disks/adfeab7d-0e98-4fa2-a1c5-37401ba524e2/permissions" rel="permissions"/>
    <link href="/ovirt-engine/api/disks/adfeab7d-0e98-4fa2-a1c5-37401ba524e2/statistics" rel="statistics"/>
    <actual_size>1073741824</actual_size>                                        
    <alias>test04_Disk1</alias>                                                  
    <content_type>data</content_type>                                            
    <format>cow</format>                                                         
    <image_id>01a281ab-bab5-46c5-b028-4a10ebe12dea</image_id>                    
    <propagate_errors>false</propagate_errors>                                   
    <provisioned_size>5368709120</provisioned_size>                              
    <qcow_version>qcow2_v3</qcow_version>                                        
    <shareable>false</shareable>                                                 
    <sparse>true</sparse>                                                        
    <status>ok</status>                                                          
    <storage_type>image</storage_type>                                           
    <total_size>0</total_size>                                                   
    <wipe_after_delete>false</wipe_after_delete>                                 
    <disk_profile href="/ovirt-engine/api/diskprofiles/cea68115-f390-48b5-b3f1-b6f12e43c456" id="cea68115-f390-48b5-b3f1-b6f12e43c456"/>
    <quota href="/ovirt-engine/api/datacenters/626f7850-5b6c-48d0-88d8-9b26d1ccfebd/quotas/994e2344-fcbb-4c7b-bdf2-3e7515d8ebab" id="994e2344-fcbb-4c7b-bdf2-3e7515d8ebab"/>
    <storage_domains>                                                            
        <storage_domain href="/ovirt-engine/api/storagedomains/08ef5828-b427-494f-b680-09ba32470926" id="08ef5828-b427-494f-b680-09ba32470926"/>
    </storage_domains>                                                           
</disk>                                                                          

DB:
engine=# select * from images JOIN disk_image_dynamic on images.image_guid = disk_image_dynamic.image_id where image_group_id ='adfeab7d-0e98-4fa2-a1c5-37401ba524e2';
-[ RECORD 1 ]---------+-------------------------------------
image_guid            | 01a281ab-bab5-46c5-b028-4a10ebe12dea
creation_date         | 2018-05-25 12:57:08+00
size                  | 5368709120
it_guid               | 00000000-0000-0000-0000-000000000000
parentid              | 00000000-0000-0000-0000-000000000000
imagestatus           | 1
lastmodified          | 1970-01-01 00:00:00+00
vm_snapshot_id        | 3d5531b1-e888-4eb1-9a92-df3bb0bc2a29
volume_type           | 2
volume_format         | 4
image_group_id        | adfeab7d-0e98-4fa2-a1c5-37401ba524e2
_create_date          | 2018-05-25 12:57:03.784241+00
_update_date          | 2018-05-25 12:57:19.289531+00
active                | t
volume_classification | 0
qcow_compat           | 2
image_id              | 01a281ab-bab5-46c5-b028-4a10ebe12dea
read_rate             | 
write_rate            | 
actual_size           | 1073741824
read_latency_seconds  | 
write_latency_seconds | 
flush_latency_seconds | 
_update_date          | 2018-05-25 12:57:19.289531+00

1) Create VM
    1.1) Template Blank
    1.20 Optimized for Desktop
2) Click Create in "Instance Images"
    2.1) Size = 5
    2.2) Storage Domain iscsi
    2.3) Allocation policy = Thin Provision
    2.4) Click Ok
3) Click Ok

rpm -q rhvm
rhvm-4.2.3.6-0.1.el7.noarch

Result: total size is 0.

Comment 6 Eyal Shenitzky 2018-05-27 06:11:38 UTC
I tried to reproduce according to the steps above and got the expected result:

<disk href="/ovirt-engine/api/disks/708e1408-0592-43fa-a43c-5381cdb4845f" id="708e1408-0592-43fa-a43c-5381cdb4845f">
<name>size_vm_Disk1</name>
<link href="/ovirt-engine/api/disks/708e1408-0592-43fa-a43c-5381cdb4845f/permissions" rel="permissions"/>
<link href="/ovirt-engine/api/disks/708e1408-0592-43fa-a43c-5381cdb4845f/statistics" rel="statistics"/>
<actual_size>1073741824</actual_size>
<alias>size_vm_Disk1</alias>
<content_type>data</content_type>
<format>cow</format>
<image_id>250310e6-3162-4967-b9ba-2b9a3a46a98b</image_id>
<propagate_errors>false</propagate_errors>
<provisioned_size>5368709120</provisioned_size>
<qcow_version>qcow2_v3</qcow_version>
<shareable>false</shareable>
<sparse>true</sparse>
<status>ok</status>
<storage_type>image</storage_type>
<total_size>1073741824</total_size>
<wipe_after_delete>false</wipe_after_delete>
<disk_profile href="/ovirt-engine/api/diskprofiles/1dfcc896-91d0-4de3-90b5-354390d2f617" id="1dfcc896-91d0-4de3-90b5-354390d2f617"/>
<quota href="/ovirt-engine/api/datacenters/8152ad85-4bfe-4e2e-9a72-469e4dc79c8d/quotas/3067cea8-61ab-4270-b330-5f2670571299" id="3067cea8-61ab-4270-b330-5f2670571299"/>
<storage_domains>
<storage_domain href="/ovirt-engine/api/storagedomains/fa8e6dda-2d2b-4402-b108-c95af781cf51" id="fa8e6dda-2d2b-4402-b108-c95af781cf51"/>
</storage_domains>
</disk>


image_guid            | 250310e6-3162-4967-b9ba-2b9a3a46a98b
creation_date         | 2018-05-27 09:06:23+03
size                  | 5368709120
it_guid               | 00000000-0000-0000-0000-000000000000
parentid              | 00000000-0000-0000-0000-000000000000
imagestatus           | 1
lastmodified          | 1970-01-01 02:00:00+02
vm_snapshot_id        | 520ef495-fba3-4855-8217-4fc942af570a
volume_type           | 2
volume_format         | 4
image_group_id        | 708e1408-0592-43fa-a43c-5381cdb4845f
_create_date          | 2018-05-27 09:06:21.050865+03
_update_date          | 2018-05-27 09:06:36.436157+03
active                | t
volume_classification | 0
qcow_compat           | 2
image_id              | 250310e6-3162-4967-b9ba-2b9a3a46a98b
read_rate             | 
write_rate            | 
actual_size           | 1073741824
read_latency_seconds  | 
write_latency_seconds | 
flush_latency_seconds | 
_update_date          | 2018-05-27 09:06:36.436157+03


Can I get an access to your environment to see what is the difference?

Comment 8 Eyal Shenitzky 2018-06-14 05:21:14 UTC
Thanks Roman,

I suppose I should have asked this before.

Comment 9 Elad 2018-07-03 22:12:33 UTC
Disk total size is reported correctly for a disk both in /disks collection and in /disks/%disk_id%



From /disks - 

<disk href="/ovirt-engine/api/disks/b0c84e87-7bd1-4e0b-8766-6dcb7de005b2" id="b0c84e87-7bd1-4e0b-8766-6dcb7de005b2">
...
<total_size>2147483648</total_size>



And from /disks/b0c84e87-7bd1-4e0b-8766-6dcb7de005b2 - 

<disk href="/ovirt-engine/api/disks/b0c84e87-7bd1-4e0b-8766-6dcb7de005b2" id="b0c84e87-7bd1-4e0b-8766-6dcb7de005b2">
...
<total_size>2147483648</total_size>



====================
Used:
rhvm-4.2.5-0.1.el7ev.noarch
ovirt-engine-restapi-4.2.5-0.1.el7ev.noarch

Comment 10 Sandro Bonazzola 2018-07-31 15:25:37 UTC
This bugzilla is included in oVirt 4.2.5 release, published on July 30th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.5 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


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