Bug 861375 - RFE: More info in qemu-img info
RFE: More info in qemu-img info
Product: Fedora
Classification: Fedora
Component: qemu (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Fedora Virtualization Maintainers
Fedora Extras Quality Assurance
Depends On:
Blocks: 861439 920225
  Show dependency treegraph
Reported: 2012-09-28 08:07 EDT by Alexander Larsson
Modified: 2013-03-11 11:37 EDT (History)
13 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 861439 920225 (view as bug list)
Last Closed: 2012-12-14 20:25:36 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Launchpad 1090615 None None None Never

  None (edit)
Description Alexander Larsson 2012-09-28 08:07:45 EDT
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:
Comment 1 Richard W.M. Jones 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:

Comment 2 Daniel Berrange 2012-09-28 11:38:08 EDT
Depending on how Boxes wants to consume this extra metadata, this may need to be done in libvirt instead, or as well. Libvirt does not actually use qemu-img info for getting file metadata, since it wants a low overhead code to extra basic properties & forking qemu-img doesn't really satisfy that.
Comment 3 Paolo Bonzini 2012-09-28 11:39:31 EDT
Fragmentation estimation and in-use space is actually quite expensive to compute---not *that* expensive but certainly worse than a fork, and worse-case O(n) in the size of the disk.
Comment 4 Stefan Hajnoczi 2012-10-23 06:17:08 EDT
Fragmentation statistics have been added to 'qemu-img check' for qcow2 and qed image files:

  commit f8111c241afa75544032dcfa23df0699c91f9866
  Author: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
  Date:   Thu Mar 15 20:13:31 2012 +0800

      qemu-img: add image fragmentation statistics

Note this is qemu-img check and not qemu-img info, because we need to scan the image metadata (expensive on large images).
Comment 5 Kevin Wolf 2012-10-23 07:58:28 EDT
Yes, I agree that most of this should be part of 'qemu-img check' rather than 'qemu-img info'.

Fragmentation statistics are only implemented for QED as of today, qcow2 doesn't have them yet.
Comment 6 Cole Robinson 2012-12-14 20:25:36 EST
In general I don't think RFE's make much sense in Fedora bugzilla, so I've moved this to the upstream qemu tracker:


Alex, I couldn't find a launchpad account for you, but please follow up on that report (or qemu-devel)

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