qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-img: allow rebase to a NULL backing file when unsafe
@ 2011-04-13 14:51 Stefan Hajnoczi
  2011-04-14  8:58 ` Kevin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2011-04-13 14:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Anthony Liguori, Stefan Hajnoczi

From: Anthony Liguori <aliguori@us.ibm.com>

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
been fully allocated and no reads can hit the backing file anymore.

Since the dropping the backing file can make the image unusable, only
allow this when the unsafe flag has been set.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 qemu-img.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index d9c2c12..ed5ba91 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1240,7 +1240,7 @@ static int img_rebase(int argc, char **argv)
         }
     }
 
-    if ((optind >= argc) || !out_baseimg) {
+    if ((optind >= argc) || (!unsafe && !out_baseimg)) {
         help();
     }
     filename = argv[optind++];
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-img: allow rebase to a NULL backing file when unsafe
  2011-04-13 14:51 [Qemu-devel] [PATCH] qemu-img: allow rebase to a NULL backing file when unsafe Stefan Hajnoczi
@ 2011-04-14  8:58 ` Kevin Wolf
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2011-04-14  8:58 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Anthony Liguori, qemu-devel

Am 13.04.2011 16:51, schrieb Stefan Hajnoczi:
> From: Anthony Liguori <aliguori@us.ibm.com>
> 
> 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
> been fully allocated and no reads can hit the backing file anymore.
> 
> Since the dropping the backing file can make the image unusable, only
> allow this when the unsafe flag has been set.

I think it would also make sense to allow it in safe mode, it would have
the same effect as rebasing onto an empty new backing file. Might take
more than a one-liner, though.

In case you need a workaround for older qemu-img versions, -b "" works,
too (at least for qcow2).

> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> ---
>  qemu-img.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/qemu-img.c b/qemu-img.c
> index d9c2c12..ed5ba91 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -1240,7 +1240,7 @@ static int img_rebase(int argc, char **argv)
>          }
>      }
>  
> -    if ((optind >= argc) || !out_baseimg) {
> +    if ((optind >= argc) || (!unsafe && !out_baseimg)) {
>          help();
>      }
>      filename = argv[optind++];

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-04-14  8:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-13 14:51 [Qemu-devel] [PATCH] qemu-img: allow rebase to a NULL backing file when unsafe Stefan Hajnoczi
2011-04-14  8:58 ` Kevin Wolf

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).