* [Qemu-devel] [PATCHv3] add qemu-img convert -C option (skip target volume creation)
@ 2013-08-12 9:42 Alex Bligh
2013-08-12 9:44 ` Alex Bligh
2013-08-12 11:11 ` Andreas Färber
0 siblings, 2 replies; 8+ messages in thread
From: Alex Bligh @ 2013-08-12 9:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Fam Zheng, Alex Bligh, Alexandre Derumier
Add a -C 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.
Code:
Author: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Alex Bligh <alex@alex.org.uk>
Documentaton:
Author: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Alex Bligh <alex@alex.org.uk>
---
qemu-img-cmds.hx | 4 ++--
qemu-img.c | 39 ++++++++++++++++++++++++---------------
qemu-img.texi | 15 ++++++++++++++-
3 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
index 4ca7e95..74ced81 100644
--- a/qemu-img-cmds.hx
+++ b/qemu-img-cmds.hx
@@ -34,9 +34,9 @@ STEXI
ETEXI
DEF("convert", img_convert,
- "convert [-c] [-p] [-q] [-f fmt] [-t cache] [-O output_fmt] [-o options] [-s snapshot_name] [-S sparse_size] filename [filename2 [...]] output_filename")
+ "convert [-c] [-p] [-q] [-C] [-f fmt] [-t cache] [-O output_fmt] [-o options] [-s snapshot_name] [-S sparse_size] filename [filename2 [...]] output_filename")
STEXI
-@item convert [-c] [-p] [-q] [-f @var{fmt}] [-t @var{cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename}
+@item convert [-c] [-p] [-q] [-C] [-f @var{fmt}] [-t @var{cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename}
ETEXI
DEF("info", img_info,
diff --git a/qemu-img.c b/qemu-img.c
index b9a848d..146909b 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -103,6 +103,8 @@ static void help(void)
" '-S' indicates the consecutive number of bytes that must contain only zeros\n"
" for qemu-img to create a sparse image during conversion\n"
" '--output' takes the format in which the output must be done (human or json)\n"
+ " '-C' skips the target volume creation (useful if the volume is created\n"
+ " prior to running qemu-img)\n"
"\n"
"Parameters to check subcommand:\n"
" '-r' tries to repair any inconsistencies that are found during the check.\n"
@@ -1116,7 +1118,8 @@ out3:
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, skipcreate;
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;
+ skipcreate = 0;
for(;;) {
- c = getopt(argc, argv, "f:O:B:s:hce6o:pS:t:q");
+ c = getopt(argc, argv, "f:O:B:s:hce6o:pS:t:qC");
if (c == -1) {
break;
}
@@ -1161,6 +1165,9 @@ static int img_convert(int argc, char **argv)
case 'c':
compress = 1;
break;
+ case 'C':
+ skipcreate = 1;
+ break;
case 'e':
error_report("option -e is deprecated, please use \'-o "
"encryption\' instead!");
@@ -1329,20 +1336,22 @@ static int img_convert(int argc, char **argv)
}
}
- /* Create the new image */
- ret = bdrv_create(drv, out_filename, param);
- if (ret < 0) {
- if (ret == -ENOTSUP) {
- error_report("Formatting not supported for file format '%s'",
- out_fmt);
- } else if (ret == -EFBIG) {
- error_report("The image size is too large for file format '%s'",
- out_fmt);
- } else {
- error_report("%s: error while converting %s: %s",
- out_filename, out_fmt, strerror(-ret));
+ if (!skipcreate) {
+ /* Create the new image */
+ ret = bdrv_create(drv, out_filename, param);
+ if (ret < 0) {
+ if (ret == -ENOTSUP) {
+ error_report("Formatting not supported for file format '%s'",
+ out_fmt);
+ } else if (ret == -EFBIG) {
+ error_report("The image size is too large for file format '%s'",
+ out_fmt);
+ } else {
+ error_report("%s: error while converting %s: %s",
+ out_filename, out_fmt, strerror(-ret));
+ }
+ goto out;
}
- goto out;
}
flags = BDRV_O_RDWR;
diff --git a/qemu-img.texi b/qemu-img.texi
index 69f1bda..9e5ba36 100644
--- a/qemu-img.texi
+++ b/qemu-img.texi
@@ -96,6 +96,14 @@ Second image format
Strict mode - fail on on different image size or sector allocation
@end table
+Parameters to convert subcommand:
+
+@table @option
+
+@item -C
+Skip the creation of the target volume
+@end table
+
Command description:
@table @option
@@ -171,7 +179,7 @@ Error on reading data
@end table
-@item convert [-c] [-p] [-f @var{fmt}] [-t @var{cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename}
+@item convert [-c] [-p] [-C] [-f @var{fmt}] [-t @var{cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename}
Convert the disk image @var{filename} or a snapshot @var{snapshot_name} to disk image @var{output_filename}
using format @var{output_fmt}. It can be optionally compressed (@code{-c}
@@ -190,6 +198,11 @@ created as a copy on write image of the specified base image; the
@var{backing_file} should have the same content as the input's base image,
however the path, image format, etc may differ.
+If the @code{-C} option is specified, the target volume creation will be
+skipped. This is useful for formats such as @code{rbd} if the target
+volume has already been created with site specific options that cannot
+be supplied through qemu-img.
+
@item info [-f @var{fmt}] [--output=@var{ofmt}] [--backing-chain] @var{filename}
Give information about the disk image @var{filename}. Use it in
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCHv3] add qemu-img convert -C option (skip target volume creation)
2013-08-12 9:42 [Qemu-devel] [PATCHv3] add qemu-img convert -C option (skip target volume creation) Alex Bligh
@ 2013-08-12 9:44 ` Alex Bligh
2013-08-12 9:58 ` Kevin Wolf
2013-08-12 11:11 ` Andreas Färber
1 sibling, 1 reply; 8+ messages in thread
From: Alex Bligh @ 2013-08-12 9:44 UTC (permalink / raw)
To: Kevin Wolf, Alexandre Derumier, Fam Zheng, qemu-devel; +Cc: Alex Bligh
--On 12 August 2013 10:42:05 +0100 Alex Bligh <alex@alex.org.uk> wrote:
> Add a -C 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.
>
> Code:
>
> Author: Alexandre Derumier <aderumier@odiso.com>
> Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
> Signed-off-by: Alex Bligh <alex@alex.org.uk>
>
> Documentaton:
Would you consider taking this for 1.6? It's really hard
to do rbd work without it, and it's pretty harmless.
--
Alex Bligh
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCHv3] add qemu-img convert -C option (skip target volume creation)
2013-08-12 9:44 ` Alex Bligh
@ 2013-08-12 9:58 ` Kevin Wolf
2013-08-12 10:10 ` Alex Bligh
2013-08-13 10:31 ` Stefan Hajnoczi
0 siblings, 2 replies; 8+ messages in thread
From: Kevin Wolf @ 2013-08-12 9:58 UTC (permalink / raw)
To: Alex Bligh; +Cc: stefanha, Fam Zheng, qemu-devel, Alexandre Derumier
Am 12.08.2013 um 11:44 hat Alex Bligh geschrieben:
>
>
> --On 12 August 2013 10:42:05 +0100 Alex Bligh <alex@alex.org.uk> wrote:
>
> >Add a -C 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.
> >
> >Code:
> >
> >Author: Alexandre Derumier <aderumier@odiso.com>
> >Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
> >Signed-off-by: Alex Bligh <alex@alex.org.uk>
> >
> >Documentaton:
>
> Would you consider taking this for 1.6? It's really hard
> to do rbd work without it, and it's pretty harmless.
Stefan's decision, but considering that the very last release candidate
is planned for today, I doubt that he's willing to take it. At least I
wouldn't. Feature freeze was long ago, and even for real bug fixes I
would be careful at this point and take nothing that isn't critical.
And even if he did take it, I wouldn't be surprised if Anthony simply
refused to pull.
Kevin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCHv3] add qemu-img convert -C option (skip target volume creation)
2013-08-12 9:58 ` Kevin Wolf
@ 2013-08-12 10:10 ` Alex Bligh
2013-08-13 10:31 ` Stefan Hajnoczi
1 sibling, 0 replies; 8+ messages in thread
From: Alex Bligh @ 2013-08-12 10:10 UTC (permalink / raw)
To: Kevin Wolf
Cc: Alexandre Derumier, Fam Zheng, stefanha, Alex Bligh, qemu-devel
On 12 Aug 2013, at 10:58, Kevin Wolf wrote:
> Stefan's decision, but considering that the very last release candidate
> is planned for today,
Ouch - I didn't realise we were that close. Point taken. I should
have gotten around to tidying up months ago.
FWIW save for the whitespace changes, I've been running this for
a good while. The patch was I think originally posted by
Alexandre to ceph-users, and I believe there are several others
using it.
--
Alex Bligh
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCHv3] add qemu-img convert -C option (skip target volume creation)
2013-08-12 9:58 ` Kevin Wolf
2013-08-12 10:10 ` Alex Bligh
@ 2013-08-13 10:31 ` Stefan Hajnoczi
1 sibling, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2013-08-13 10:31 UTC (permalink / raw)
To: Kevin Wolf; +Cc: Fam Zheng, Alexandre Derumier, Alex Bligh, qemu-devel
On Mon, Aug 12, 2013 at 11:58:51AM +0200, Kevin Wolf wrote:
> Am 12.08.2013 um 11:44 hat Alex Bligh geschrieben:
> >
> >
> > --On 12 August 2013 10:42:05 +0100 Alex Bligh <alex@alex.org.uk> wrote:
> >
> > >Add a -C 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.
> > >
> > >Code:
> > >
> > >Author: Alexandre Derumier <aderumier@odiso.com>
> > >Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
> > >Signed-off-by: Alex Bligh <alex@alex.org.uk>
> > >
> > >Documentaton:
> >
> > Would you consider taking this for 1.6? It's really hard
> > to do rbd work without it, and it's pretty harmless.
>
> Stefan's decision, but considering that the very last release candidate
> is planned for today, I doubt that he's willing to take it. At least I
> wouldn't. Feature freeze was long ago, and even for real bug fixes I
> would be careful at this point and take nothing that isn't critical.
>
> And even if he did take it, I wouldn't be surprised if Anthony simply
> refused to pull.
It's too late. At this stage I'm just looking out for critical bug
fixes.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCHv3] add qemu-img convert -C option (skip target volume creation)
2013-08-12 9:42 [Qemu-devel] [PATCHv3] add qemu-img convert -C option (skip target volume creation) Alex Bligh
2013-08-12 9:44 ` Alex Bligh
@ 2013-08-12 11:11 ` Andreas Färber
2013-08-12 11:16 ` Alex Bligh
2013-08-12 11:43 ` Alex Bligh
1 sibling, 2 replies; 8+ messages in thread
From: Andreas Färber @ 2013-08-12 11:11 UTC (permalink / raw)
To: Alex Bligh
Cc: Kevin Wolf, Stefan Hajnoczi, Fam Zheng, qemu-devel,
Alexandre Derumier
Am 12.08.2013 11:42, schrieb Alex Bligh:
> Add a -C 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.
>
> Code:
>
> Author: Alexandre Derumier <aderumier@odiso.com>
> Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
> Signed-off-by: Alex Bligh <alex@alex.org.uk>
>
> Documentaton:
>
> Author: Alex Bligh <alex@alex.org.uk>
> Signed-off-by: Alex Bligh <alex@alex.org.uk>
> ---
This is a rather odd notation...
The way git-commit works, any committer's Signed-off-by will be placed
directly under the documentation chunk, but it's supposed to cover the
whole commit/patch, not just some aspect of it.
Since as you write, the code is his, the patch should have his From, his
Signed-off-by and finally your Signed-off-by. You can detail your
changes in [AB: ...] or similar between the Signed-off-bys. (To change
the authorship, use git commit --amend --author="Name <email>".)
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCHv3] add qemu-img convert -C option (skip target volume creation)
2013-08-12 11:11 ` Andreas Färber
@ 2013-08-12 11:16 ` Alex Bligh
2013-08-12 11:43 ` Alex Bligh
1 sibling, 0 replies; 8+ messages in thread
From: Alex Bligh @ 2013-08-12 11:16 UTC (permalink / raw)
To: Andreas Färber
Cc: Kevin Wolf, Fam Zheng, Alex Bligh, qemu-devel, Alexandre Derumier,
Stefan Hajnoczi
--On 12 August 2013 13:11:54 +0200 Andreas Färber <afaerber@suse.de> wrote:
> The way git-commit works, any committer's Signed-off-by will be placed
> directly under the documentation chunk, but it's supposed to cover the
> whole commit/patch, not just some aspect of it.
>
> Since as you write, the code is his, the patch should have his From, his
> Signed-off-by and finally your Signed-off-by. You can detail your
> changes in [AB: ...] or similar between the Signed-off-bys. (To change
> the authorship, use git commit --amend --author="Name <email>".)
By that logic I should split the code and the documentation. I'll do that.
--
Alex Bligh
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCHv3] add qemu-img convert -C option (skip target volume creation)
2013-08-12 11:11 ` Andreas Färber
2013-08-12 11:16 ` Alex Bligh
@ 2013-08-12 11:43 ` Alex Bligh
1 sibling, 0 replies; 8+ messages in thread
From: Alex Bligh @ 2013-08-12 11:43 UTC (permalink / raw)
To: Andreas Färber
Cc: Kevin Wolf, Fam Zheng, Alex Bligh, qemu-devel, Alexandre Derumier,
Stefan Hajnoczi
On 12 Aug 2013, at 12:11, Andreas Färber wrote:
> Since as you write, the code is his, the patch should have his From, his
> Signed-off-by and finally your Signed-off-by. You can detail your
> changes in [AB: ...] or similar between the Signed-off-bys. (To change
> the authorship, use git commit --amend --author="Name <email>".)
Per IRC conversation with you and kwolf, done the way you suggested
in patchv4 just posted.
--
Alex Bligh
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-08-13 10:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-12 9:42 [Qemu-devel] [PATCHv3] add qemu-img convert -C option (skip target volume creation) Alex Bligh
2013-08-12 9:44 ` Alex Bligh
2013-08-12 9:58 ` Kevin Wolf
2013-08-12 10:10 ` Alex Bligh
2013-08-13 10:31 ` Stefan Hajnoczi
2013-08-12 11:11 ` Andreas Färber
2013-08-12 11:16 ` Alex Bligh
2013-08-12 11:43 ` Alex Bligh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).