summaryrefslogtreecommitdiffstats
path: root/qemu-img.c
diff options
context:
space:
mode:
authorPeter Maydell2017-07-19 11:48:31 +0200
committerPeter Maydell2017-07-19 11:48:31 +0200
commitf1a46e888515c6b49f3d43f938a9c17acac831f5 (patch)
tree59634db84fc7e9c7c616b26401a8afb8175c0353 /qemu-img.c
parentMerge remote-tracking branch 'remotes/berrange/tags/pull-qio-2017-07-18-1' in... (diff)
parentqemu-img: Check for backing image if specified during create (diff)
downloadqemu-f1a46e888515c6b49f3d43f938a9c17acac831f5.tar.gz
qemu-f1a46e888515c6b49f3d43f938a9c17acac831f5.tar.xz
qemu-f1a46e888515c6b49f3d43f938a9c17acac831f5.zip
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block layer patches # gpg: Signature made Tue 18 Jul 2017 14:29:59 BST # gpg: using RSA key 0x7F09B272C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: (21 commits) qemu-img: Check for backing image if specified during create blockdev: move BDRV_O_NO_BACKING option forward block/vvfat: Fix compiler warning with gcc 7 vvfat: initialize memory after allocating it vvfat: correctly parse non-ASCII short and long file names vvfat: add a constant for bootsector name vvfat: add constants for special values of name[0] qemu-iotests: Test unplug of -device without drive qemu-iotests: Test 'info block' scsi-disk: bdrv_attach_dev() for empty CD-ROM ide: bdrv_attach_dev() for empty CD-ROM block: List anonymous device BBs in query-block block/qapi: Use blk_all_next() for query-block block: Make blk_all_next() public block/qapi: Add qdev device name to query-block block: Make blk_get_attached_dev_id() public block/vpc.c: Handle write failures in get_image_offset() block/vmdk: Report failures in vmdk_read_cid() block: remove timer canceling in throttle_config() block: add clock_type field to ThrottleGroup ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 182e697f81..eb32b93e90 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -150,9 +150,11 @@ static void QEMU_NORETURN help(void)
" 'snapshot_id_or_name' is deprecated, use 'snapshot_param'\n"
" instead\n"
" '-c' indicates that target image must be compressed (qcow format only)\n"
- " '-u' enables unsafe rebasing. It is assumed that old and new backing file\n"
- " match exactly. The image doesn't need a working backing file before\n"
- " rebasing in this case (useful for renaming the backing file)\n"
+ " '-u' allows unsafe backing chains. For rebasing, it is assumed that old and\n"
+ " new backing file match exactly. The image doesn't need a working\n"
+ " backing file before rebasing in this case (useful for renaming the\n"
+ " backing file). For image creation, allow creating without attempting\n"
+ " to open the backing file.\n"
" '-h' with or without a command shows this help and lists the supported formats\n"
" '-p' show progress of command (only certain commands)\n"
" '-q' use Quiet mode - do not print any output (except errors)\n"
@@ -429,6 +431,7 @@ static int img_create(int argc, char **argv)
char *options = NULL;
Error *local_err = NULL;
bool quiet = false;
+ int flags = 0;
for(;;) {
static const struct option long_options[] = {
@@ -436,7 +439,7 @@ static int img_create(int argc, char **argv)
{"object", required_argument, 0, OPTION_OBJECT},
{0, 0, 0, 0}
};
- c = getopt_long(argc, argv, ":F:b:f:ho:q",
+ c = getopt_long(argc, argv, ":F:b:f:ho:qu",
long_options, NULL);
if (c == -1) {
break;
@@ -476,6 +479,9 @@ static int img_create(int argc, char **argv)
case 'q':
quiet = true;
break;
+ case 'u':
+ flags |= BDRV_O_NO_BACKING;
+ break;
case OPTION_OBJECT: {
QemuOpts *opts;
opts = qemu_opts_parse_noisily(&qemu_object_opts,
@@ -528,7 +534,7 @@ static int img_create(int argc, char **argv)
}
bdrv_img_create(filename, fmt, base_filename, base_fmt,
- options, img_size, 0, quiet, &local_err);
+ options, img_size, flags, quiet, &local_err);
if (local_err) {
error_reportf_err(local_err, "%s: ", filename);
goto fail;