RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 861439 - RFE: More info in qemu-img info
Summary: RFE: More info in qemu-img info
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Stefan Hajnoczi
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 861375
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-28 15:35 UTC by Paolo Bonzini
Modified: 2014-06-18 03:18 UTC (History)
16 users (show)

Fixed In Version: QEMU 1.5
Doc Type: Enhancement
Doc Text:
Clone Of: 861375
Environment:
Last Closed: 2014-06-13 11:09:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Paolo Bonzini 2012-09-28 15:35:58 UTC
+++ 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 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 15:05:50 UTC
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 07:22:44 UTC
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 11:09:01 UTC
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.