Bug 1259116 - qemu can not read disk size of libiscsi and it shows 'disk size: unavailable'
qemu can not read disk size of libiscsi and it shows 'disk size: unavailable'
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
7.2
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Fam Zheng
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-01 21:45 EDT by Pei Zhang
Modified: 2016-03-28 05:25 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-10-20 00:52:53 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Pei Zhang 2015-09-01 21:45:57 EDT
Description of problem:
After formatting qcow2 image of libiscsi, the disk size shows unavailable which is not friendly to user. If this is a block device, maybe the disk size should be set 0 or other appropriate value. 

Version-Release number of selected component (if applicable):
Host:
Kernel:3.10.0-313.el7.x86_64
qemu-kvm-rhev:qemu-kvm-rhev-2.3.0-21.el7.x86_64


How reproducible:
100%


Steps to Reproduce:
1.
# qemu-img create -f qcow2 iscsi://10.66.9.120:3260/iqn.2003-01.org.linux-iscsi.dhcp-9-120.x8664:sn.68d22325a05a/0 20G
Formatting 'iscsi://10.66.9.120:3260/iqn.2003-01.org.linux-iscsi.dhcp-9-120.x8664:sn.68d22325a05a/0', fmt=qcow2 size=21474836480 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
2.
# qemu-img info iscsi://10.66.9.120:3260/iqn.2003-01.org.linux-iscsi.dhcp-9-120.x8664:sn.68d22325a05a/0
image: iscsi://10.66.9.120:3260/iqn.2003-01.org.linux-iscsi.dhcp-9-120.x8664:sn.68d22325a05a/0
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: unavailable
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false


Actual results:
disk size:unavailable

Expected results:
disk size: 0 (or other appropriate value).


Additional info:
Comment 2 Fam Zheng 2015-09-07 21:25:33 EDT
Actually I think unavailable is more accurate than "0". The allocation status can be retrieved by QEMU scanning each block in the target but that can take unnecessarily long time just to display the summary for the image. So I'm not sure this issue is worth fixing.
Comment 3 Paolo Bonzini 2015-10-19 06:49:43 EDT
I agree with Fam.  Alternatively, qcow2 could store a high-water mark into the header, and qemu-img info could use it.  CCing Kevin for ideas, but I'm okay with CLOSED/NOTABUG.
Comment 4 Kevin Wolf 2015-10-19 09:42:46 EDT
You don't actually have to store another value in the qcow2 header. Scanning
the last refcount block should be quick enough. However, I'm still not
convinced whether that's useful enough to actually do it on every qcow2_open().

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