Bug 861439 - RFE: More info in qemu-img info
RFE: More info in qemu-img info
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Stefan Hajnoczi
Virtualization Bugs
: FutureFeature
Depends On: 861375
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-28 11:35 EDT by Paolo Bonzini
Modified: 2014-06-17 23:18 EDT (History)
16 users (show)

See Also:
Fixed In Version: QEMU 1.5
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: 861375
Environment:
Last Closed: 2014-06-13 07:09:01 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Paolo Bonzini 2012-09-28 11:35:58 EDT
+++ This bug was initially created as a clone of Bug #861375 +++

qemu-img info currently give me info like this:

image: /home/alex/.local/share/gnome-boxes/images/Fedora 16
file format: qcow2
virtual size: 11G (11794287616 bytes)
disk size: 4.5G
cluster_size: 65536

In order to figure out the "health" of an image there is some more information I would like:

in-use disk size - I.e the subset of disk size that is not marked as unused due to e.g. TRIM operations

amount of compressed clusters. I.e. "is it useful to re-compress the image".

Fragmentation estimation.

This would be useful to both sysadmins in general and for automated things like
what we want to do in gnome-boxes:
https://bugzilla.gnome.org/show_bug.cgi?id=685032

--- Additional comment from rjones@redhat.com on 2012-09-28 08:18:50 EDT ---

All sounds useful.  However these requests should probably
go upstream, along with patches!

Note upstream there is a patch floating around which adds
JSON output to qemu-img info.  This is useful because it's
a big security problem to try to parse the text output from
this command.  See:

https://lists.gnu.org/archive/html/qemu-devel/2012-09/msg00137.html
Comment 1 Stefan Hajnoczi 2013-03-11 11:05:50 EDT
Fragmentation, allocation, and compressed cluster statistics are available in "qemu-img check" upstream.

$ qemu-img info test.qcow2
image: test.qcow2
file format: qcow2
virtual size: 16G (17179869184 bytes)
disk size: 1.8G
cluster_size: 65536
$ qemu-img check test.qcow2
No errors were found on the image.
29877/29902 = 99.92% allocated, 0.00% fragmented, 0.00% compressed clusters
Image end offset: 1959657472

Both "qemu-img check" and "qemu-img info" support --output json for programmatic queries.

Marking as complete, please try qemu.git/master qemu-img and raise new bugs if you need other enhancements.
Comment 3 Xu Han 2014-01-23 02:22:44 EST
Test result of qemu-img-1.3.0-6.el7.x86_64

# qemu-img info RHEL-Server-7.0-64-virtio.qcow2
image: RHEL-Server-7.0-64-virtio.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 13G
cluster_size: 65536

# qemu-img check RHEL-Server-7.0-64-virtio.qcow2
No errors were found on the image.
----
Test result of qemu-img-1.5.3-40.el7.x86_64

# qemu-img info RHEL-Server-7.0-64-virtio.qcow2
image: RHEL-Server-7.0-64-virtio.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 13G
cluster_size: 65536
Format specific information:
    compat: 0.10

# qemu-img check RHEL-Server-7.0-64-virtio.qcow2 
No errors were found on the image.
214519/327680 = 65.47% allocated, 0.48% fragmented, 0.00% compressed clusters
Image end offset: 14061338624

----
Base on these test results above, this bug has been fixed.
Comment 5 Ludek Smid 2014-06-13 07:09:01 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

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