From: Eric Blake <eblake@redhat.com>
To: Alex Bligh <alex@alex.org.uk>
Cc: Kevin Wolf <kwolf@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org, Alexandre Derumier <aderumier@odiso.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCHv5] add qemu-img convert -n option (skip target volume creation)
Date: Fri, 30 Aug 2013 11:31:52 -0600 [thread overview]
Message-ID: <5220D708.7050802@redhat.com> (raw)
In-Reply-To: <1377508321-16507-2-git-send-email-alex@alex.org.uk>
[-- Attachment #1: Type: text/plain, Size: 2766 bytes --]
On 08/26/2013 03:12 AM, Alex Bligh wrote:
> From: Alexandre Derumier <aderumier@odiso.com>
>
> 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
> output format, there may be parameters which are not possible
> to specify through the qemu-img convert command line.
>
> Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
> Signed-off-by: Alex Bligh <alex@alex.org.uk>
> ---
> static int img_convert(int argc, char **argv)
> {
> - int c, ret = 0, n, n1, bs_n, bs_i, compress, cluster_size, cluster_sectors;
> + int c, ret = 0, n, n1, bs_n, bs_i, compress, cluster_size,
> + cluster_sectors, skip_create;
Pre-existing usage, but this new variable is used only as a bool, so it
might be better to type it (and others like it) correctly...
> int progress = 0, flags;
> const char *fmt, *out_fmt, *cache, *out_baseimg, *out_filename;
> BlockDriver *drv, *proto_drv;
> @@ -1139,8 +1142,9 @@ static int img_convert(int argc, char **argv)
> cache = "unsafe";
> out_baseimg = NULL;
> compress = 0;
> + skip_create = 0;
...which would mean using 'false' instead of '0' here, and so forth. As
at least 'compress' is also impacted, I'm okay deferring the type
cleanup to a separate patch.
> for(;;) {
> - c = getopt(argc, argv, "f:O:B:s:hce6o:pS:t:q");
> + c = getopt(argc, argv, "f:O:B:s:hce6o:pS:t:qn");
The order here...
> if (c == -1) {
> break;
> }
> @@ -1161,6 +1165,9 @@ static int img_convert(int argc, char **argv)
> case 'c':
> compress = 1;
> break;
> + case 'n':
> + skip_create = 1;
> + break;
...and the order of the case statements, are unrelated. Which makes
maintenance a bit harder. Personally, I like to keep my optstring in
case-insensitive order, then my case statements in the same order. But
that's cosmetic, it doesn't affect the correctness of the patch.
> +++ b/tests/qemu-iotests/060
> @@ -0,0 +1,101 @@
> +#!/bin/bash
> +#
> +# test of qemu-img convert -n - convert without creation
> +#
> +# Copyright (C) 2009 Red Hat, Inc.
Where have you been the last 4 years? I could understand a range of
years, if this test borrows significantly from another file that old,
but I suspect that just 2013 is probably more accurate.
Fix that, and you can add:
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]
next prev parent reply other threads:[~2013-08-30 17:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-26 9:12 [Qemu-devel] [PATCHv5] add qemu-img convert -n option (skip target volume creation) Alex Bligh
2013-08-26 9:12 ` Alex Bligh
2013-08-30 17:31 ` Eric Blake [this message]
2013-08-30 18:13 ` Alex Bligh
2013-08-30 18:55 ` Eric Blake
2013-08-30 19:22 ` Alex Bligh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5220D708.7050802@redhat.com \
--to=eblake@redhat.com \
--cc=aderumier@odiso.com \
--cc=alex@alex.org.uk \
--cc=aliguori@us.ibm.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.