Statistics
| Branch: | Revision:

root / qemu-img.c @ cc84d90f

History | View | Annotate | Download (74.9 kB)

# Date Author Comment
34b5d2c6 09/12/2013 11:12 am Max Reitz

block: Error parameter for open functions

Add an Error ** parameter to bdrv_open, bdrv_file_open and associated
functions to allow more specific error messages.

Signed-off-by: Max Reitz <>

cc84d90f 09/12/2013 11:12 am Max Reitz

block: Error parameter for create functions

Add an Error ** parameter to bdrv_create and its associated functions to
allow more specific error messages.

Signed-off-by: Max Reitz <>

a89d89d3 09/12/2013 11:12 am Wenchao Xia

snapshot: distinguish id and name in snapshot delete

Snapshot creation actually already distinguish id and name since it take
a structured parameter *sn, but delete can't. Later an accurate delete
is needed in qmp_transaction abort and blockdev-snapshot-delete-sync,...

6f176b48 09/12/2013 11:12 am Max Reitz

block: Image file option amendment

This patch adds the "amend" option to qemu-img which allows changing
image options on existing image files. It also adds the generic bdrv
implementation which is basically just a wrapper for the image format
specific function....

d663640c 09/06/2013 04:25 pm Paolo Bonzini

block: expect errors from bdrv_co_is_allocated

Some bdrv_is_allocated callers do not expect errors, but the fallback
in qcow2.c might make other callers trip on assertion failures or
infinite loops.

Fix the callers to always look for errors.

Cc: ...

e4a86f88 09/06/2013 04:25 pm Paolo Bonzini

qemu-img: always probe the input image for allocated sectors

qemu-img convert can assume "that sectors which are unallocated in the
input image are present in both the output's and input's base images".

However it is only doing this if the output image returns true for...

11212d8f 09/06/2013 04:25 pm Paolo Bonzini

block: make bdrv_has_zero_init return false for copy-on-write-images

This helps implementing is_allocated on top of get_block_status.

Reviewed-by: Eric Blake <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Stefan Hajnoczi <>

4c93a13b 09/06/2013 04:25 pm Paolo Bonzini

qemu-img: add a "map" subcommand

This command dumps the metadata of an entire chain, in either tabular or JSON
format.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Stefan Hajnoczi <>

4f6fd349 09/06/2013 04:25 pm Fam Zheng

block: make bdrv_delete() static

Manage BlockDriverState lifecycle with refcnt, so bdrv_delete() is no
longer public and should be called by bdrv_unref() if refcnt is
decreased to 0.

This is an identical change because effectively, there's no multiple
reference of BDS now: no caller of bdrv_ref() yet, only bdrv_new() sets...

b2e10493 09/06/2013 04:25 pm Alexandre Derumier

add qemu-img convert -n option (skip target volume creation)

Add a -n option to skip volume creation on qemu-img convert.
This is useful for targets such as rbd / ceph, where the
target volume may already exist; we cannot always rely on
qemu-img convert to create the image, as dependent on the...

fc11eb26 08/06/2013 11:41 am Kevin Wolf

qemu-img: Error out for excess arguments

Don't silently ignore excess arguments at the end of the command line,
but error out instead. This can catch typos like 'resize test.img + 1G',
which doesn't increase the image size by 1G as intended, but truncates...

526eda14 08/06/2013 11:41 am MORITA Kazutaka

ignore SIGPIPE in qemu-img and qemu-io

This prevents the tools from being stopped when they write data to a
closed connection in the other side.

Signed-off-by: MORITA Kazutaka <>
Reviewed-by: Paolo Bonzini <>...

98289620 07/15/2013 10:49 am Kevin Wolf

block: Don't parse protocol from file.filename

One of the major reasons for doing something new for -blockdev and
blockdev-add was that the old block layer code parses filenames instead
of just taking them literally. So we should really leave it untouched...

7c30f657 06/21/2013 09:52 pm Stefan Weil

qemu-img: Add missing GCC_FMT_ATTR

Signed-off-by: Stefan Weil <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Michael Tokarev <>

fb0ed453 06/07/2013 02:37 pm Wenchao Xia

block: add snapshot info query function bdrv_query_snapshot_info_list()

This patch adds function bdrv_query_snapshot_info_list(), which will
retrieve snapshot info of an image in qmp object format. The implementation
is based on the code moved from qemu-img.c with modification to fit more...

43526ec8 06/07/2013 02:37 pm Wenchao Xia

block: add image info query function bdrv_query_image_info()

This patch adds function bdrv_query_image_info(), which will
retrieve image info in qmp object format. The implementation is
based on the code moved from qemu-img.c, but uses block layer
function to get snapshot info....

5e00984a 06/06/2013 12:27 pm Kevin Wolf

cutils: Support 'P' and 'E' suffixes in strtosz()

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>
Signed-off-by: Stefan Hajnoczi <>

f364ec65 06/04/2013 02:56 pm Wenchao Xia

block: move qmp and info dump related code to block/qapi.c

This patch is a pure code move patch, except following modification:
1 get_human_readable_size() is changed to static function.
2 dump_human_image_info() is renamed to bdrv_image_info_dump().
3 in qmp_query_block() and qmp_query_blockstats, use bdrv_next(bs)...

5b917044 06/04/2013 02:56 pm Wenchao Xia

block: dump snapshot and image info to specified output

bdrv_snapshot_dump() and bdrv_image_info_dump() do not dump to a buffer now,
some internal buffers are still used for format control, which have no
chance to be truncated. As a result, these two functions have no more issue...

54f106d5 04/22/2013 11:27 am Stefan Hajnoczi

qemu-img: do not zero-pad the compressed write buffer

bdrv_write_compressed() does not allow requests that span the end of the
device. Therefore it is useless to zero-pad the last cluster and
thereby exceed the end of the device.

Let image formats handle zero-padding the final compressed cluster, if...

de9c0cec 03/15/2013 05:07 pm Kevin Wolf

block: Add options QDict to bdrv_open() prototype

It doesn't do anything yet except storing the options QDict in the
BlockDriverState.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>
Reviewed-by: Stefan Hajnoczi <>...

d14ed18c 02/22/2013 10:21 pm Miroslav Rezanina

qemu-img: Add compare subcommand

This patch adds new qemu-img subcommand that compares content of two disk
images.

Signed-off-by: Miroslav Rezanina <>
Reviewed-by: Kevin Wolf <>
Signed-off-by: Stefan Hajnoczi <>

c9fc5083 02/22/2013 10:21 pm Stefan Hajnoczi

qemu-img: fix missing space in qemu-img check output

The qemu-img check fragmentation printf() is missing a space before the
'=' sign. The human output is not guaranteed to be stable and we are
not aware of screen scrapers, so add the missing space.

Also fix the missing indentation of the printf() arguments....

e6439d78 02/22/2013 10:21 pm Stefan Hajnoczi

qemu-img: add compressed clusters to BlockFragInfo

Show how many clusters are compressed. This can be used to monitor how
many compressed clusters remain and whether to recompress the image.

Suggested-by: Cole Robinson <>
Signed-off-by: Stefan Hajnoczi <>

f382d43a 02/22/2013 10:21 pm Miroslav Rezanina

qemu-img: Add "Quiet mode" option

There can be a need to turn output to stdout off. This patch adds a -q option
that enable "Quiet mode". In Quiet mode, only errors are printed out.

Signed-off-by: Miroslav Rezanina <>
Reviewed-by: Kevin Wolf <>...

c6bb9ad1 02/22/2013 10:21 pm Federico Simoncelli

qemu-img: find the image end offset during check

This patch adds the support for reporting the image end offset (in
bytes). This is particularly useful after a conversion (or a rebase)
where the destination is a block device in order to find the first
unused byte at the end of the image....

8599ea4c 02/22/2013 10:21 pm Federico Simoncelli

qemu-img: add json output option to the check command

This option --output=[human|json] makes qemu-img check output a human
or JSON representation at the choice of the user.

Signed-off-by: Federico Simoncelli <>
Reviewed-by: Eric Blake <>...

79443397 01/02/2013 05:08 pm liguang

qemu-img: report size overflow error message

qemu-img will complain when qcow or qcow2
size overflow for 64 bits, report the right
message in this condition.

$./qemu-img create -f qcow2 /tmp/foo 0x10000000000000000
before change:
qemu-img: Invalid image size specified! You may use k, M, G or T suffixes for...

9c17d615 12/19/2012 09:32 am Paolo Bonzini

softmmu: move include files to include/sysemu/

Signed-off-by: Paolo Bonzini <>

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

7b1b5d19 12/19/2012 09:31 am Paolo Bonzini

qapi: move include files to include/qobject/

Signed-off-by: Paolo Bonzini <>

737e150e 12/19/2012 09:31 am Paolo Bonzini

block: move include files to include/block/

Signed-off-by: Paolo Bonzini <>

e478b448 12/11/2012 05:35 pm Dong Xu Wang

use qemu_opts_create_nofail

We will use qemu_opts_create_nofail function, it can make code
more readable.

Signed-off-by: Dong Xu Wang <>
Signed-off-by: Kevin Wolf <>

71c79813 12/11/2012 12:05 pm Luiz Capitulino

block: bdrv_img_create(): add Error ** argument

This commit adds an Error ** argument to bdrv_img_create() and set it
appropriately on error.

Callers of bdrv_img_create() pass NULL for the new argument and still
rely on bdrv_img_create()'s return value. Next commits will change...

9b37525a 12/11/2012 12:05 pm Luiz Capitulino

qemu-img: img_create(): pass Error object to bdrv_img_create()

Signed-off-by: Luiz Capitulino <>
Signed-off-by: Kevin Wolf <>

a9300911 12/11/2012 12:05 pm Luiz Capitulino

qemu-img: img_create(): drop unneeded goto and ret variable

Signed-off-by: Luiz Capitulino <>
Signed-off-by: Kevin Wolf <>

2592c59a 11/06/2012 02:37 am Paolo Bonzini

tools: initialize main loop before block layer

Tools were broken because they initialized the block layer while
qemu_aio_context was still NULL.

Reported-by: malc <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: malc <>

9699bf0d 10/24/2012 11:26 am Stefan Hajnoczi

qemu-img: Add --backing-chain option to info command

The qemu-img info --backing-chain option enumerates the backing file
chain. For example, for base.qcow2 <- snap1.qcow2 <- snap2.qcow2 the
output becomes:

$ qemu-img info --backing-chain snap2.qcow2...
1f710495 10/24/2012 11:26 am Kevin Wolf

qemu-img: Fix division by zero for zero size images

Signed-off-by: Kevin Wolf <>
Reviewed-by: Paolo Bonzini <>

a616673d 10/24/2012 11:26 am Alex Bligh

qemu-img rebase: use empty string to rebase without backing file

This patch allows an empty filename to be passed as the new base image name
for qemu-img rebase to mean base the image on no backing file (i.e.
independent of any backing file). According to Eric Blake, qemu-img rebase...

109820df 09/17/2012 06:23 pm Anthony Liguori

Merge remote-tracking branch 'kwolf/for-anthony' into staging

  • kwolf/for-anthony:
    block: Don't forget to delete temporary file
    Don't require encryption password for 'qemu-img info' command
    qemu-img: Add json output option to the info command.
    qapi: Add SnapshotInfo and ImageInfo....
0546b8c2 09/14/2012 10:21 am Stefan Weil

Spelling fixes in comments and documentation

These wrong spellings were detected by codespell:

  • successully -> successfully
  • alot -> a lot
  • wanna -> want to
  • infomation -> information
  • occured -> occurred

["also is" -> "is also" and "ressources" -> "resources" suggested by...

c054b3fd 09/12/2012 04:50 pm Benoît Canet

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.

example: {
"snapshots": [ {
"vm-clock-nsec": 637102488,
"name": "vm-20120821145509",...

f0536bb8 09/12/2012 04:50 pm Daniel P. Berrange

Don't require encryption password for 'qemu-img info' command

The encryption password is only required if I/O is going to be
performed on a disk image. The 'qemu-img info' command merely
reports metadata, so it should not ask for a decryption password

Signed-off-by: Daniel P. Berrange <>...

058f8f16 08/10/2012 11:25 am Stefan Hajnoczi

block: add BLOCK_O_CHECK for qemu-img check

Image formats with a dirty bit, like qed and qcow2, repair dirty image
files upon open with BDRV_O_RDWR. Performing automatic repair when
qemu-img check runs is not ideal because the bdrv_open() call repairs
the image before the actual bdrv_check() call from qemu-img.c....

20caf0f7 08/06/2012 11:39 pm Dong Xu Wang

qemu-img: use QemuOpts instead of QEMUOptionParameter in resize function

Signed-off-by: Dong Xu Wang <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

c8057f95 08/02/2012 09:16 pm Peter Maydell

Support 'help' as a synonym for '?' in command line options

For command line options which permit '?' meaning 'please list the
permitted values', add support for 'help' as a synonym, by abstracting
the check out into a helper function.

This change means that in some cases where we were being lazy in...

f8d6bba1 06/15/2012 03:03 pm Markus Armbruster

block: Replace bdrv_get_format() by bdrv_get_format_name()

So callers don't need to know anything about maximum name length.
Returning a pointer is safe, because the name string lives as long as
the block driver it names, and block drivers don't die.

Requested by Peter Maydell....

4534ff54 06/15/2012 03:03 pm Kevin Wolf

qemu-img check -r for repairing images

The QED block driver already provides the functionality to not only
detect inconsistencies in images, but also fix them. However, this
functionality cannot be manually invoked with qemu-img, but the
check happens only automatically during bdrv_open()....

ccf34716 06/15/2012 03:03 pm Kevin Wolf

qemu-img check: Print fixed clusters and recheck

When any inconsistencies have been fixed, print the statistics and run
another check to make sure everything is correct now.

Signed-off-by: Kevin Wolf <>

fa170c14 05/14/2012 06:02 pm Charles Arnold

qemu-img: Fix segmentation fault

The following command generates a segmentation fault.
qemu-img convert -O vpc -o ? test test2
This is because the 'goto out;' statement calls qemu_progress_end
before qemu_progress_init is called resulting in a NULL pointer...

dc5a1371 05/10/2012 11:32 am Paolo Bonzini

qemu-img: make "info" backing file output correct and easier to use

qemu-img info should use the same logic as qemu when printing the
backing file path, or debugging becomes quite tricky. We can also
simplify the output in case the backing file has an absolute path...

80ccf93b 04/20/2012 12:42 pm Liu Yuan

qemu-img: let 'qemu-img convert' flush data

The 'qemu-img convert -h' advertise that the default cache mode is
'writeback', while in fact it is 'unsafe'.

This patch 1) fix the help manual and 2) let bdrv_close() call bdrv_flush()

2) is needed because some backend storage doesn't have a self-flush...

64c79160 04/05/2012 03:54 pm Dong Xu Wang

qemu-img: add dirty flag status

Some block drivers can verify their image files are clean or not. So we can show
it while using "qemu-img info".

Signed-off-by: Dong Xu Wang <>
Reviewed-by: Stefan Hajnoczi <>...

f8111c24 04/05/2012 03:54 pm Dong Xu Wang

qemu-img: add image fragmentation statistics

Discussion can be found at:
http://patchwork.ozlabs.org/patch/128730/

This patch add image fragmentation statistics while using qemu-img check.

Signed-off-by: Dong Xu Wang <>
Reviewed-by: Stefan Hajnoczi <>...

259b2173 03/12/2012 04:14 pm Kevin Wolf

qcow2: Add error messages in qcow2_truncate

qemu-img resize has some limitations with qcow2, but the user is only
told that "this image format does not support resize". Quite confusing,
so add some more detailed error_report() calls and change "this image...

67d384e8 02/29/2012 05:05 pm Zhi Yong Wu

qemu-img: fix segment fault when the image format is qed

[root@f15 qemu]# qemu-img info /home/zwu/work/misc/rh6.img
image: /home/zwu/work/misc/rh6.img
file format: qed
virtual size: 4.0G (4294967296 bytes)
disk size: 1.2G
cluster_size: 65536
Segmentation fault (core dumped)...

1a6d39fd 02/09/2012 05:17 pm Stefan Hajnoczi

cutils: extract buffer_is_zero() from qemu-img.c

The qemu-img.c:is_not_zero() function checks if a buffer contains all
zeroes. This function will come in handy for zero-detection in the
block layer, so clean it up and move it to cutils.c.

Note that the function now returns true if the buffer is all zeroes....

87a1b3e3 12/15/2011 01:40 pm Kevin Wolf

qemu-img rebase: Fix for undersized backing files

Backing files may be smaller than the corresponding COW file. When
reading directly from the backing file, qemu-img rebase must consider
this and assume zero sectors after the end of backing files.

Signed-off-by: Kevin Wolf <>...

e36b3695 11/29/2011 12:20 am Markus Armbruster

qemu-img: Tighten parsing of size arguments

strtosz_suffix() fails unless the size is followed by 0, whitespace or
','. Useless here, because we need to fail for any junk following the
size, even if it starts with whitespace or ','. Check manually.
Things like "qemu-img create xxx 1024," and "qemu-img convert -S '1024...

41521fa4 10/21/2011 06:34 pm Kevin Wolf

qemu-img: Don't allow preallocation and compression at the same time

Only qcow and qcow2 can do compression at all, and they require unallocated
clusters when writing the compressed data.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Stefan Hajnoczi <>

a22f123c 08/29/2011 03:42 pm Kevin Wolf

qemu-img: Require larger zero areas for sparse handling

By default, require 4k of consecutive zero bytes for qemu-img to make the
output file sparse by not issuing a write request for the zeroed parts. Add an
-S option to allow users to tune this setting....

c3993cdc 08/23/2011 03:15 pm Stefan Hajnoczi

block: parse cache mode flags in a single place

This patch introduces bdrv_parse_cache_flags() which sets open flags
given a cache mode. Previously this was duplicated in blockdev.c and
qemu-img.c.

Signed-off-by: Stefan Hajnoczi <>...

92196b2f 08/23/2011 03:15 pm Stefan Hajnoczi

block: add cache=directsync parameter to -drive

This patch adds -drive cache=directsync for O_DIRECT | O_SYNC host file
I/O with no disk write cache presented to the guest.

This mode is useful when guests may not be sending flushes when
appropriate and therefore leave data at risk in case of power failure....

bb1c0597 08/23/2011 03:15 pm Kevin Wolf

qemu-img: Use qemu_blockalign

Now that you can use cache=none for the output file in qemu-img, we should
properly align our buffers so that raw-posix doesn't have to use its (smaller)
bounce buffer.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Stefan Hajnoczi <>

3fba9d81 08/23/2011 03:15 pm Stefan Hajnoczi

qemu-img: print error codes when convert fails

Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

4a1d5e1f 07/19/2011 04:39 pm Fam Zheng

block: add bdrv_get_allocated_file_size() operation

qemu-img.c wants to count allocated file size of image. Previously it
counts a single bs->file by 'stat' or Window API. As VMDK introduces
multiple file support, the operation becomes format specific with...

661a0f71 07/05/2011 12:23 pm Federico Simoncelli

qemu-img: Add cache command line option

qemu-img currently writes disk images using writeback and filling
up the cache buffers which are then flushed by the kernel preventing
other processes from accessing the storage.
This is particularly bad in cluster environments where time-based...

9d42e15d 06/24/2011 11:13 am Markus Armbruster

qemu-img: Don't prepend qemu-img to error messages twice.

error_report() prepends the location already. Example:

$ qemu-img convert -6
qemu-img: qemu-img: option -6 is deprecated, please use '-o compat6' instead!

Signed-off-by: Markus Armbruster <>...

6daf194d 06/24/2011 11:13 am Markus Armbruster

Strip trailing '\n' from error_report()'s first argument

error_report() prepends location, and appends a newline. The message
constructed from the arguments should not contain a newline. Fix the
obvious offenders.

Signed-off-by: Markus Armbruster <>...

f6a00aa1 05/18/2011 03:39 pm Dmitry Konishchev

qemu_img: is_not_zero() optimization

I run qemu-img under profiler and realized, that most of CPU time is
consumed by is_not_zero() function. I had made a couple of optimizations
on it and got the following output for `time qemu-img convert -O qcow2
volume.qcow2 snapshot.qcow2`:...

4ee96418 05/18/2011 03:38 pm Jes Sorensen

qemu-img.c: Remove superfluous parenthesis

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

e80fec7f 05/03/2011 12:29 pm Kevin Wolf

qemu-img resize: Fix option parsing

For shrinking images, you're supposed to use a negative size. However, the
leading minus makes getopt think that it's an option and so you get the help
text if you don't use -- like in 'qemu-img resize test.img -- -1G'....

9a9d9dba 04/27/2011 12:12 pm Anthony Liguori

qemu-img: allow rebase to a NULL backing file when unsafe

QEMU can drop a backing file so that an image file no longer depends on
the backing file, but this feature has not been exposed in qemu-img.
This is useful in an image streaming usecase or when an image file has...

eb863add 04/07/2011 02:51 pm Kevin Wolf

qemu-img rebase: Fix segfault if backing file can't be opened

bdrv_delete must not be called for a NULL BlockDriverState.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Stefan Hajnoczi <>

6b837bc4 04/07/2011 02:51 pm Jes Sorensen

qemu-img: Initial progress printing support

This adds the basic infrastructure for supporting progress output
on the command line, as well as progress support for qemu-img commands
'rebase' and 'convert'.

Signed-off-by: Jes Sorensen <>...

b9eaf9ec 02/10/2011 02:24 pm Kevin Wolf

qemu-img: Improve error messages for failed bdrv_open

Output the error message string of the bdrv_open return code. Also set a
non-empty device name for the images because the unknown feature error message
includes it.

Signed-off-by: Kevin Wolf <>...

710da702 01/24/2011 12:08 pm Kevin Wolf

qemu-img snapshot: Use writeback caching

None of the other qemu-img subcommands uses writethrough, and there's no reason
why snapshot should be special.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Stefan Hajnoczi <>

70b4f4bb 01/24/2011 12:08 pm Jes Sorensen

Make strtosz() return int64_t instead of ssize_t

strtosz() needs to return a 64 bit type even on 32 bit
architectures. Otherwise qemu-img will fail to create disk
images >= 2GB

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

53f76e58 12/17/2010 05:11 pm Kevin Wolf

qemu-img: Call error_set_progname

Call error_set_progname during the qemu-img initialization, so that error
messages printed with error_report() use the right prefix.

Signed-off-by: Kevin Wolf <>

f88e1a42 12/17/2010 05:11 pm Jes Sorensen

qemu-img.c: Re-factor img_create()

This patch re-factors img_create() moving the code doing the actual
work into block.c where it can be shared with QEMU. This is needed to
be able to create images from QEMU to be used for live snapshots.

Signed-off-by: Jes Sorensen <>...

15654a6d 12/17/2010 05:11 pm Jes Sorensen

qemu.img.c: Use error_report() instead of own error() implementation

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

ad717139 12/17/2010 05:11 pm Kevin Wolf

Remove NULL checks for bdrv_new return value

It's an indirect call to qemu_malloc, which never returns an error.

Signed-off-by: Kevin Wolf <>

1da7cfbd 12/17/2010 05:10 pm Jes Sorensen

qemu-img.c: Clean up handling of image size in img_create()

This cleans up the handling of image size in img_create() by parsing
the value early, and then only setting it once if a value has been
added as the last argument to the command line.

Signed-off-by: Jes Sorensen <>...

5bdf61fd 12/14/2010 04:44 pm Jes Sorensen

Use qemu_mallocz() instead of calloc() in img_convert()

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

31ca34b8 12/14/2010 04:44 pm Jes Sorensen

img_convert(): Only try to free bs[] entries if bs is valid.

This allows for jumping to 'out:' consistently for error exit.

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

4ac8aacd 12/14/2010 04:44 pm Jes Sorensen

Consolidate printing of block driver options

This consolidates the printing of block driver options in
print_block_option_help() which is called from both img_create() and
img_convert().

This allows for the "?" detection to be done just after the parsing of...

b8fb60da 12/14/2010 04:44 pm Jes Sorensen

Fix formatting and missing braces in qemu-img.c

Signed-off-by: Jes Sorensen <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

ef87394c 12/14/2010 04:44 pm Jes Sorensen

Fail if detecting an unknown option

This patch changes qemu-img to exit if an unknown option is detected,
instead of trying to continue with a set of arguments which may be
incorrect.

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

2a81998a 12/14/2010 04:44 pm Jes Sorensen

Make error handling more consistent in img_create() and img_resize()

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

eec77d9e 12/14/2010 04:44 pm Jes Sorensen

qemu-img: Deprecate obsolete -6 and -e options

If -6 or -e is specified, an error message is printed and we exit. It
does not print help() to avoid the error message getting lost in the
noise.

Signed-off-by: Jes Sorensen <>
Signed-off-by: Kevin Wolf <>

a87a6721 12/14/2010 04:44 pm Stefan Hajnoczi

qemu-img: Free option parameter lists in img_create()

Free option parameter lists in the img_create() error return path.

Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

5eeaad5a 12/14/2010 04:44 pm Stefan Hajnoczi

qemu-img: Fail creation if backing format is invalid

The qemu-img create command should check the backing format to ensure
only image files with valid backing formats are created. By checking in
qemu-img.c we can print a useful error message.

Signed-off-by: Stefan Hajnoczi <>...

dc786bc9 10/30/2010 11:02 am Jes Sorensen

Move qemu_gettimeofday() to OS specific files

Signed-off-by: Jes Sorensen <>
Signed-off-by: Blue Swirl <>

51ef6727 10/22/2010 03:49 pm edison

Copy snapshots out of QCOW2 disk

In order to backup snapshots, created from QCOW2 iamge, we want to copy snapshots out of QCOW2 disk to a seperate storage.
The following patch adds a new option in "qemu-img": qemu-img convert -f qcow2 -O qcow2 -s snapshot_name src_img bck_img....

a18953fb 10/22/2010 03:49 pm Kevin Wolf

qemu-img: Fix qemu-img convert -obacking_file

The old -B option caused a backing file to be used for the converted image and
to avoid copying clusters from the old backing file. When replaced with
-obacking_file, qemu-img convert does assign the backing file to the new image,...

8b7968f7 10/03/2010 09:34 am Stefan Weil

Use GCC_FMT_ATTR (format checking)

Signed-off-by: Stefan Weil <>
Signed-off-by: Blue Swirl <>

1bd8e175 09/08/2010 01:39 pm Kevin Wolf

qemu-img convert: Use cache=unsafe for output image

If qemu-img crashes during the conversion, the user will throw away the broken
output file anyway and start over. So no need to be too cautious.

Signed-off-by: Kevin Wolf <>

cdbae851 08/30/2010 07:29 pm Kevin Wolf

qemu-img rebase: Open new backing file read-only

We never write to a backing file, so opening rw is useless. It just means that
you can't rebase on top of a file for which you don't have write permissions.

Signed-off-by: Kevin Wolf <>