Patchwork [3/4] blockdev: Allow snapshoting of protocols.

login
register
mail settings
Submitter Benoît Canet
Date Jan. 28, 2013, 1:22 p.m.
Message ID <1359379338-5974-4-git-send-email-benoit@irqsave.net>
Download mbox | patch
Permalink /patch/216184/
State New
Headers show

Comments

Benoît Canet - Jan. 28, 2013, 1:22 p.m.
Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 blockdev.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Stefan Hajnoczi - Jan. 28, 2013, 3:51 p.m.
On Mon, Jan 28, 2013 at 02:22:17PM +0100, Benoît Canet wrote:
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
>  blockdev.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/blockdev.c b/blockdev.c
> index 0ce45c5..b1f388b 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -800,7 +800,8 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp)
>          /* We will manually add the backing_hd field to the bs later */
>          states->new_bs = bdrv_new("");
>          ret = bdrv_open(states->new_bs, new_image_file,
> -                        flags | BDRV_O_NO_BACKING, drv);
> +                        flags | BDRV_O_NO_BACKING,
> +                        path_has_protocol(new_image_file) ?  NULL : drv);

This seems like a hack.  The reason for doing this is because you don't
want new_image_file to be opened as qcow2, for example.  I don't think
it has much to do with new_image_file specifying a protocol.

Not sure what alternative to propose yet...

Stefan

Patch

diff --git a/blockdev.c b/blockdev.c
index 0ce45c5..b1f388b 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -800,7 +800,8 @@  void qmp_transaction(BlockdevActionList *dev_list, Error **errp)
         /* We will manually add the backing_hd field to the bs later */
         states->new_bs = bdrv_new("");
         ret = bdrv_open(states->new_bs, new_image_file,
-                        flags | BDRV_O_NO_BACKING, drv);
+                        flags | BDRV_O_NO_BACKING,
+                        path_has_protocol(new_image_file) ?  NULL : drv);
         if (ret != 0) {
             error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file);
             goto delete_and_fail;