This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1475974 - [RFE] use qemu-img measure (estimates the size of QCOW2 image converted from a raw image)
[RFE] use qemu-img measure (estimates the size of QCOW2 image converted from ...
Status: NEW
Product: Red Hat OpenStack
Classification: Red Hat
Component: RFEs (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: RHOS Maint
: FutureFeature
Depends On: 1433670
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-27 12:49 EDT by Ademar Reis
Modified: 2017-07-28 13:06 EDT (History)
18 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: 1433670
Environment:
Last Closed:
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 Ademar Reis 2017-07-27 12:49:24 EDT
This is being implemented in qemu-img, as requested by the RHV team. It might be useful in OpenStack as well.

+++ This bug was initially created as a clone of Bug #1433670 +++

Description of problem:
I was wondering if that will be possible to provide a new API that estimates the size of qcow2 image converted from a raw image.
We could use this new API to allocate the size more precisely before the convert operation.

The operation that we are trying to do is to convert a raw sparse image from NFS or from block device to qcow2 image on thin provisioned block device

In ovirt thin provisioned block device is a regular lv, and we like
to allocate only the required size for the the qcow file.

Our current (stupid) solution is to allocate the entire LV using the
size of the raw image.


Here is an example flow:

    $ truncate -s 10G test.raw

We don't know what will be the size of the qcow on the block storage,
so we allocate the entire LV:

    $ lvcreate --size 10G vg/lv

Then we convert the file to the new LV:

    $ qemu-img convert -f raw -O qcow2 test.raw /dev/vg/lv

After the copy we can check the actual size:

    $ qemu-img check /dev/vg/lv

And reduce the LV:

    $ lvreduce -L128m vg/lv

But we like to avoid the allocation, and allocate only the needed size
before we convert the image.

We think that the best way to solve this issue is to return this info
from qemu-img, maybe as a flag to qemu-img convert that will
calculate the size of the converted image without doing any writes.


Version-Release number of selected component (if applicable):

--- Additional comment from Stefan Hajnoczi on 2017-07-14 06:01:00 BRT ---

The following commits are now in qemu.git/master and will be included in the next qemu-kvm-rhev rebase:

32a1681 iotests: add test 178 for qemu-img measure
217a068 qemu-iotests: support per-format golden output files
fd03c2b qemu-img: add measure subcommand
c501c35 qcow2: add bdrv_measure() support
0eb4a8c qcow2: extract image creation option parsing
7c5bcc4 qcow2: make refcount size calculation conservative
95c67e3 qcow2: extract preallocation calculation function
a843a22 raw-format: add bdrv_measure() support
90880ff block: add bdrv_measure() API

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