History | View | Annotate | Download (43 kB)
qemu-img resize: Fix option parsing
For shrinking images, you're supposed to use a negative size. However, theleading minus makes getopt think that it's an option and so you get the helptext if you don't use -- like in 'qemu-img resize test.img -- -1G'....
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 onthe 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...
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 <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
qemu-img: Initial progress printing support
This adds the basic infrastructure for supporting progress outputon the command line, as well as progress support for qemu-img commands'rebase' and 'convert'.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>...
qemu-img: Improve error messages for failed bdrv_open
Output the error message string of the bdrv_open return code. Also set anon-empty device name for the images because the unknown feature error messageincludes it.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
qemu-img snapshot: Use writeback caching
None of the other qemu-img subcommands uses writethrough, and there's no reasonwhy snapshot should be special.
Make strtosz() return int64_t instead of ssize_t
strtosz() needs to return a 64 bit type even on 32 bitarchitectures. Otherwise qemu-img will fail to create diskimages >= 2GB
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-img: Call error_set_progname
Call error_set_progname during the qemu-img initialization, so that errormessages printed with error_report() use the right prefix.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-img.c: Re-factor img_create()
This patch re-factors img_create() moving the code doing the actualwork into block.c where it can be shared with QEMU. This is needed tobe able to create images from QEMU to be used for live snapshots.
qemu.img.c: Use error_report() instead of own error() implementation
Remove NULL checks for bdrv_new return value
It's an indirect call to qemu_malloc, which never returns an error.
qemu-img.c: Clean up handling of image size in img_create()
This cleans up the handling of image size in img_create() by parsingthe value early, and then only setting it once if a value has beenadded as the last argument to the command line.
Use qemu_mallocz() instead of calloc() in img_convert()
img_convert(): Only try to free bs[] entries if bs is valid.
This allows for jumping to 'out:' consistently for error exit.
Consolidate printing of block driver options
This consolidates the printing of block driver options inprint_block_option_help() which is called from both img_create() andimg_convert().
This allows for the "?" detection to be done just after the parsing of...
Fix formatting and missing braces in qemu-img.c
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
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 beincorrect.
Make error handling more consistent in img_create() and img_resize()
qemu-img: Deprecate obsolete -6 and -e options
If -6 or -e is specified, an error message is printed and we exit. Itdoes not print help() to avoid the error message getting lost in thenoise.
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 <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-img: Fail creation if backing format is invalid
The qemu-img create command should check the backing format to ensureonly image files with valid backing formats are created. By checking inqemu-img.c we can print a useful error message.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>...
Move qemu_gettimeofday() to OS specific files
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
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....
qemu-img: Fix qemu-img convert -obacking_file
The old -B option caused a backing file to be used for the converted image andto 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,...
Use GCC_FMT_ATTR (format checking)
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
qemu-img convert: Use cache=unsafe for output image
If qemu-img crashes during the conversion, the user will throw away the brokenoutput file anyway and start over. So no need to be too cautious.
qemu-img rebase: Open new backing file read-only
We never write to a backing file, so opening rw is useless. It just means thatyou can't rebase on top of a file for which you don't have write permissions.
qemu-img check: Distinguish different kinds of errors
People think that their images are corrupted when in fact there are just someleaked clusters. Differentiating several error cases should make the messagesmore comprehensible.
qemu-img: avoid calling exit(1) to release resources properly
This patch removes exit(1) from error(), and properly releasesresources such as a block driver and an allocated memory.
For testing the Sheepdog block driver with qemu-iotests, it isnecessary to call bdrv_delete() before the program exits. Because the...
add support for protocol driver create_options
This patch enables protocol drivers to use their create options whichare not supported by the format. For example, protcol drivers can usea backing_file option with raw format.
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>...
Fix %lld or %llx printf format use
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
qemu-img: Add 'resize' command to grow/shrink disk images
This patch adds a 'resize' command to grow/shrink disk images. Thisallows changing the size of disk images without copying to a new imagefile. Currently only raw files support resize.
qemu-img rebase: Fix output image corruption
qemu-img rebase must always give clusters in the COW file priority over thosein the backing file. As it failed to use number of non-allocated clusters butassumed the maximum, it was possible that allocated clusters were taken from...
block: bdrv_has_zero_init
This fixes the problem that qemu-img's use of no_zero_init only considered theno_zero_init flag of the format driver, but not of the underlying protocols.
Between the raw/file split and this fix, converting to host devices is broken....
qemu-img: Eliminate bdrv_new_open() code duplication
Several commands have code to create a BlockDriverState and open a file.The bdrv_new_open() function can be used to perform these steps. Thispatch converts the qemu-img commands to actually use bdrv_new_open()....
qemu-img: Fix BRDV_O_FLAGS typo
It should be BDRV_O_FLAGS instead of BRDV_O_FLAGS.
Replace calls of old bdrv_open
What is known today as bdrv_open2 becomes the new bdrv_open. All remainingcallers of the old function are converted to the new one. In some places theyeven know the right format, so they should have used bdrv_open2 from the...
block: print errno on error
Now that we changed all create calls to return errno, just print it.
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-img rebase: Add -f option
Allow the user to specify the format of the image to rebase.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-img: Fix segfault during rebase
This fixes a possible read beyond the end of the temporary buffers used forcomparing data in the old and the new backing file.
qemu-img: Fix error message
When qemu-img can't open the new backing file for a rebase, it prints an errormessage which contains the file name of the old backing file. This is wrong,obviously.
qemu-img: use the heap instead of the huge stack array for win32
The default stack size of PE is 1MB on win32 and IO_BUF_SIZE inimg_convert() & img_rebase() is 2MB, so qemu-img will crash when doing"convert" & "rebase" on win32.Although we can improve the stack size of PE to resolve it, I think we...
qemu-img: Fix qemu-img can't create qcow image based on read-only image
Commit 03cbdac7 "Disable fall-back to read-only when cannot open drive'sfile for read-write" result in read-only image can't be used as backedimage in qemu-img.
Cc: Naphtali Sprei <nsprei@redhat.com>...
Revert "On some systems printf is a macro"
This reverts commit bc5b6004588ad17370e0416e40b4aa9cf977023b.
qemu-img: avoid preprocessor directives in a printf call
Other choices include using "(printf)", but this one is not bad interms of readability.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: malc <av1474@comtv.ru>
On some systems printf is a macro
Signed-off-by: malc <av1474@comtv.ru>
Ask for read-write permissions when opening files
Found some places that seems needs this explicitly, now thatread-write is not the default.
Signed-off-by: Naphtali Sprei <nsprei@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Clean-up a little bit the RW related bits of BDRV_O_FLAGS. BDRV_O_RDONLY gone (and so is BDRV_O_ACCESS). Default value for bdrv_flags (0/zero) is READ-ONLY. Need to explicitly request READ-WRITE.
Instead of using the field 'readonly' of the BlockDriverState struct for passing the request,...
block: Introduce BDRV_O_NO_BACKING
If an image references a backing file that doesn't exist, qemu-img info failsto open this image. Exactly in this case the info would be valuable, though:the user might want to find out which file is missing.
This patch introduces a BDRV_O_NO_BACKING flag to ignore the backing file when...
qemu-img rebase
This adds a rebase subcommand to qemu-img which allows to change the backingfile of an image.
In default mode, both the current and the new backing file need to exist, andafter the rebase, the COW image is guaranteed to have the same guest visible...
qemu-img: Fix memory leak
Fix description of size parameter in qemu-img's help text
Valid description taken from qemu-img.texi, although it would be betterto have this information recorded in only one place.
Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-img: There is more than one host device driver
I haven't heard yet of anyone using qemu-img to copy an image to a real floppy,but it's a valid use case.
Documentation: Don't mention old qemu-img options
The old options are still supported for compatibility, but they areinconsistent (for example create -b vs. convert -B for backing files) andincomplete (-F only exists for create) which tends to confuse people. Remove...
qemu-img: Allow creating zero sized images
A size of 0 should be valid and cannot be treated as "missing value". Use -1for this purpose instead.
qcow2: Increase maximum cluster size to 2 MB
This patch increases the maximum qcow2 cluster size to 2 MB. Starting with 128kclusters, L2 tables span 2 GB or more of virtual disk space, causing 32 bittruncation and wraparound of signed integers. Therefore some variables need to...
Revert "Get rid of _t suffix"
In the very least, a change like this requires discussion on the list.
The naming convention is goofy and it causes a massive merge problem. Somethinglike this must be presented on the list first so people can provide input...
Get rid of _t suffix
Some not so obvious bits, slirp and Xen were left alone for the timebeing.
qmu-img: fix qemu-img convert to generate a valid image when the source referenced a backing file
Make 'qemu-img convert' copies unallocated parts of the source imagewhen -B option was not specified.
Signed-off-by: Akkarit Sangpetch <asangpet@andrew.cmu.edu>...
Use hxtool for qemu-img command list
Use hxtool to generate the 'command syntax' section of qemu-img's helpmessage, and the corresponding section of the texinfo documentation.
This has the side-effect of adding 'check' to this list of commands inthe texinfo documentation....
Document changes in qemu-img interface
Update the documentation to reflect the introduction of format specific optionswith -o. Don't advertise -e or -6 any more, they exist only for compatibilityreasons and can be replaced by the corresponding -o options....
qemu-img: Print available options with -o ?
This patch adds a small help text to each of the options in the block driverswhich can be displayed by using qemu-img create -f fmt -o ?
Convert qemu-img convert to new bdrv_create
This is part two of the qemu-img conversion. This really works the same as theprevious conversion of qemu-img create: It introduces a new -o option for thegeneric approach and adds the old-style options to this option set....
Convert all block drivers to new bdrv_create
Now we can make use of the newly introduced option structures. Instead ofhaving bdrv_create carry more and more parameters (which are format specific inmost cases), just pass a option structure as defined by the driver itself....
Convert qemu-img create to new bdrv_create
This patch changes qemu-img to actually use the new bdrv_create interface. Ittranslates the old-style qemu-img options which have been bdrv_create2parameters or flags so far to option structures. As the generic approach, it...
Convert block infrastructure to use new module init functionality
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Include assert.h from qemu-common.h
Include assert.h from qemu-common.h and remove other direct uses.cpu-all.h still need to include it because of the dyngen-exec.h hacks
Signed-off-by: Paul Brook <paul@codesourcery.com>
Introduce qemu-img check subcommand (Kevin Wolf)
From: Kevin Wolf <kwolf@redhat.com>
Now that block drivers can provide check functions, expose them throughqemu-img.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
block-vpc: Don't silently create smaller image than requested
The algorithm from the VHD specification for CHS calculation silently limitsimages to 127 GB which may confuse a user who requested a larger image. Betteroutput an error message and abort.
Add host_device support to qemu-img. (Nolan Leake)
This patch allows the use a host_device as the destination for "qemu-imgconvert".
I added a ->bdrv_create function host_device. It merely verifies thatthe device exists and is large enough.
A check is needed in the qemu-img convert loop to ensure that we write...
qemu-img: adding a "-F base_fmt" option to "qemu-img create -b" (Uri Lublin)
If the user specifies the backing file format,then when opening the backing file, there is no needto probe the (backing file) image to figure out its format.
This follows my previous patches implementing bdrv_create2...
Revert r6408
This series is broken by design as it requires expensive IO operations atopen time causing very long delays when starting a virtual machine for thefirst time.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6812 c046a42c-6fe2-441c-8c8c-71466251a162
qemu-img: fix help message
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6787 c046a42c-6fe2-441c-8c8c-71466251a162
qemu-img: accept sizes with decimal values
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6786 c046a42c-6fe2-441c-8c8c-71466251a162
Fix windows build and clean up use of <windows.h>
We want to globally define WIN_LEAN_AND_MEAN and WINVER to particular values solet's do it in OS_CFLAGS.
Then, we can pepper in windows.h includes where using #includes that require it.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
Make qemu-img argument handling POSIX compliant
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6578 c046a42c-6fe2-441c-8c8c-71466251a162
Replace noreturn with QEMU_NORETURN
Thanks to Robert Riebisch for analysis [1]
[1] http://marc.info/?l=qemu-devel&m=123352293319271&w=2
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6492 c046a42c-6fe2-441c-8c8c-71466251a162
Synch code, help and docs
Rearrange code, help printout and docs so that they are in the same(hopefully more logical) order for easier maintenance.
Add help and docs for undocumented options.
Reformat slightly for more consistent help output.
Add comments to encourage better synchronization in the future....
Fix format warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6417 c046a42c-6fe2-441c-8c8c-71466251a162
qemu-img: info: show highest_alloc and num_free_bytes if exist (Uri Lublin)
Signed-off-by: Uri Lublin <uril@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6408 c046a42c-6fe2-441c-8c8c-71466251a162
qemu-img: Fix type of getopt return value (Kevin Wolf)
getopt doesn't return a char but an int.
Signed-off-by: Kevin Wolf <kwolf@suse.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6331 c046a42c-6fe2-441c-8c8c-71466251a162
Add noreturn function attribute
Introduce noreturn attribute and attach it to cpu_loop_exit as well asinterrupt/exception helpers for i386. This avoids a bunch of gcc4warnings.
[ Note that this patch comes with a workaround to include qemu-common.heven in cases where is currently causes conflicts with dyngen-exec.h....
snapshot subcommand for qemu-img (Kevin Wolf)
Add snapshot subcommand to qemu-img which allows to list, create, applyand delete snapshots on qcow2 images.
...
qemu-img: open files with cache=writeback
Data integrity is not important in qemu-img, so open the files withcache=writeback. This fixes the performance regression seen with qemu-imgsince revision 5485, and most particularly with the qcow2 format.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>...
Fix OpenBSD linker warnings in qemu-img
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5078 c046a42c-6fe2-441c-8c8c-71466251a162
Revert 4977. Laurent asked for this not to be applied but I mistakenly appliedit.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4978 c046a42c-6fe2-441c-8c8c-71466251a162
qemu-img: set encrypted disk image password (Laurent Vivier)
This patch modify qemu-img to ask and set a password when an encrypteddisk image is created.
Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>...
New qemu-img convert -B option, by Marc Bevand.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4672 c046a42c-6fe2-441c-8c8c-71466251a162
Remove osdep.c/qemu-img code duplication
(Kevin Wolf)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4191 c046a42c-6fe2-441c-8c8c-71466251a162
Correct qemu-img usage hint (Andreas Färber).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3975 c046a42c-6fe2-441c-8c8c-71466251a162
copyright update
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3893 c046a42c-6fe2-441c-8c8c-71466251a162
Use WIN32_LEAN_AND_MEAN, by Stefan Weil.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3832 c046a42c-6fe2-441c-8c8c-71466251a162
Fix bdrv_get_geometry to return uint64_t, by Andre Przywara.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3825 c046a42c-6fe2-441c-8c8c-71466251a162
Cleanup qemu-img.c.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3579 c046a42c-6fe2-441c-8c8c-71466251a162
Split block API from vl.h.Remove QEMU_TOOL. Replace with QEMU_IMG and NEED_CPU_H.Avoid linking qemu-img against whole system emulatior.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3578 c046a42c-6fe2-441c-8c8c-71466251a162
Support multipart images as input to qemu-img (Salvador Fandino).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3496 c046a42c-6fe2-441c-8c8c-71466251a162
Fix typo, spotted by Edivaldo de Araujo Pereira.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3434 c046a42c-6fe2-441c-8c8c-71466251a162
find -type f | xargs sed -i 's/[\t ]*$//g' # Yes, again. Note the star in the regex.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3177 c046a42c-6fe2-441c-8c8c-71466251a162
vmdk compatibility level 6 images, by Soren Hansen.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3175 c046a42c-6fe2-441c-8c8c-71466251a162
find -type f | xargs sed -i 's/[\t ]$//g' # on most files
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162