Bug 1578259 - qemu-img info 'actual-size' return value is not documented
Summary: qemu-img info 'actual-size' return value is not documented
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: qemu-kvm
Version: ---
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Hanna Czenczek
QA Contact: Tingting Mao
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-15 06:53 UTC by Eyal Shenitzky
Modified: 2019-11-06 07:12 UTC (History)
12 users (show)

Fixed In Version: qemu-kvm-4.1.0-10.module+el8.1.0+4234+33aa4f57
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-06 07:11:30 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:3723 0 None None None 2019-11-06 07:12:01 UTC

Description Eyal Shenitzky 2018-05-15 06:53:21 UTC
Description of problem:

When performing qemu-img info command on a volume, the 'actual-size' return value content is missing from the documentation.

The documentation is needed in order to clarify what is the content of the returned 'actual-size' parameter:

File storage: the number of allocated blocks multiplied by
              the block size 512.
Block storage: always 0

Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux Server release 7.5 Beta

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Nir Soffer 2018-05-16 14:34:25 UTC
Also, qemu-img uses different names for the same thing, for example:

$ qemu-img info test.qcow2 
image: test.qcow2
file format: qcow2
virtual size: 100G (107374182400 bytes)
disk size: 1.3M
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

$ qemu-img info test.qcow2 --output json
{
    "virtual-size": 107374182400,
    "filename": "test.qcow2",
    "cluster-size": 65536,
    "format": "qcow2",
    "actual-size": 1314816,
    "format-specific": {
        "type": "qcow2",
        "data": {
            "compat": "1.1",
            "lazy-refcounts": false,
            "refcount-bits": 16,
            "corrupt": false
        }
    },
    "dirty-flag": false
}

So we have:

--output human:
    image
    disk size
    cluster_size

--output json:
    filename
    actual-size
    cluster-size

Looking at qemu-img -h and man qemu-img, this seems to be a general issue with
the result format. Command line options and arguments are documented, but the format of the output is never documented. This is an issue for programs that want to use qemu-img json output.

Comment 3 Ademar Reis 2018-05-16 15:04:23 UTC
Looks like this was added in this commit:

commit c054b3fd78f28b12f4d066583fc0ade017752479
Author: Benoît Canet <benoit>
Date:   Wed Sep 5 13:09:02 2012 +0200

    qemu-img: Add json output option to the info command.
    
    This option --output=[human|json] make qemu-img info output on
    human or JSON representation at the choice of the user.

Comment 6 Ademar Reis 2019-08-19 17:37:41 UTC
In 4.1 with the commits 4db4390ef31648be28626dff51e87e3647485a46 and 987402c5c2c777cf3a1faf26f9a5a82f587bd3a4. Marking BZ as POST.

Comment 9 Hanna Czenczek 2019-09-18 06:24:46 UTC
Hi,

The issue described in comment 2 continues to exists because (1) I think changing our output format may be a compatibility problem, and (2) I personally find “actual size” to be less intuitively meaningful than “disk size”.  But it’s clear that we cannot rename the JSON field, because that definitely would be a compatibility problem.  As for “filename” vs. “image”, I feel that’s just a result of --output=json and --output=human being useful for different consumers.  I think it would be weird for --output=human to report a “filename” (because the user would expect that to be exactly what they called qemu-img info with, which is not necessarily the case), but again, we cannot change --output=json.  (And I don’t see any problem for “file format” vs. “format” or “cluster_size” vs. “cluster-size”.)

As for actual-size, it isn’t documented in the man page because it has no place there.  What the man page does say is:

> The command can output in the format ofmt which is either "human" or "json".  The JSON output is an object of QAPI type "ImageInfo"; with "--backing-chain", it is an array of "ImageInfo" objects.

And the ImageInfo QAPI type is documented in the QAPI/QMP documentation (qemu-qmp-ref.7).


(The --output=human fields are documented in the man page, because there is no other place where we already document them; with the exception of “format specific information”, which again references the QAPI documentation.)


Thanks,

Max

Comment 10 Tingting Mao 2019-09-18 08:06:19 UTC
Thanks Max a lot, I can find the info now. And set this bug as verified accordingly.


Tested with:
qemu-kvm-4.1.0-10.module+el8.1.0+4234+33aa4f57


Get content 'actual-size' in the doc file:
# cat /usr/share/doc/qemu-kvm/qemu-qmp-ref.txt | grep "actual-size" -A 2 
     'actual-size: int' (optional)
          actual size on disk in bytes of the image
     'dirty-flag: boolean' (optional)

Comment 12 errata-xmlrpc 2019-11-06 07:11:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHBA-2019:3723


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