Patchwork [v2,03/17] block: add error parameter to bdrv_snapshot_goto() and related functions

login
register
mail settings
Submitter Pavel Hrdina
Date Dec. 13, 2012, 3:40 p.m.
Message ID <b190773b701003cc1a1e859a70d6cf4d11edfae8.1355404685.git.phrdina@redhat.com>
Download mbox | patch
Permalink /patch/206189/
State New
Headers show

Comments

Pavel Hrdina - Dec. 13, 2012, 3:40 p.m.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 block.c                | 27 ++++++++++++++++-----------
 block.h                |  3 ++-
 block/qcow2-snapshot.c | 15 ++++++++++++---
 block/qcow2.h          |  4 +++-
 block/rbd.c            |  6 +++++-
 block/sheepdog.c       | 14 +++++++-------
 block_int.h            |  3 ++-
 qemu-img.c             |  6 +-----
 savevm.c               |  2 +-
 9 files changed, 49 insertions(+), 31 deletions(-)
Luiz Capitulino - Dec. 14, 2012, 4:30 p.m.
On Thu, 13 Dec 2012 16:40:37 +0100
Pavel Hrdina <phrdina@redhat.com> wrote:

> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>

The same comments I made in the previous patch apply here: you're
keeping the error code and converting callers to propagate error
in the same patch (which makes this difficult to review).

> ---
>  block.c                | 27 ++++++++++++++++-----------
>  block.h                |  3 ++-
>  block/qcow2-snapshot.c | 15 ++++++++++++---
>  block/qcow2.h          |  4 +++-
>  block/rbd.c            |  6 +++++-
>  block/sheepdog.c       | 14 +++++++-------
>  block_int.h            |  3 ++-
>  qemu-img.c             |  6 +-----
>  savevm.c               |  2 +-
>  9 files changed, 49 insertions(+), 31 deletions(-)
> 
> diff --git a/block.c b/block.c
> index fea429b..d012b0e 100644
> --- a/block.c
> +++ b/block.c
> @@ -3098,29 +3098,34 @@ int bdrv_snapshot_create(BlockDriverState *bs,
>  }
>  
>  int bdrv_snapshot_goto(BlockDriverState *bs,
> -                       const char *snapshot_id)
> +                       const char *snapshot_id,
> +                       Error **errp)
>  {
>      BlockDriver *drv = bs->drv;
>      int ret, open_ret;
>  
> -    if (!drv)
> -        return -ENOMEDIUM;
> -    if (drv->bdrv_snapshot_goto)
> -        return drv->bdrv_snapshot_goto(bs, snapshot_id);
> -
> -    if (bs->file) {
> +    if (!drv) {
> +        error_setg(errp, "Device '%s' has no medium.",
> +                   bdrv_get_device_name(bs));
> +        ret = -ENOMEDIUM;
> +    } else if (drv->bdrv_snapshot_goto) {
> +        ret = drv->bdrv_snapshot_goto(bs, snapshot_id, errp);
> +    } else if (bs->file) {
>          drv->bdrv_close(bs);
> -        ret = bdrv_snapshot_goto(bs->file, snapshot_id);
> +        ret = bdrv_snapshot_goto(bs->file, snapshot_id, errp);
>          open_ret = drv->bdrv_open(bs, bs->open_flags);
>          if (open_ret < 0) {
>              bdrv_delete(bs->file);
>              bs->drv = NULL;
> -            return open_ret;
> +            error_setg(errp, "Failed to open '%s'.", bdrv_get_device_name(bs));
> +            ret = open_ret;
>          }
> -        return ret;
> +    } else {
> +        error_setg(errp, "Not supported.");
> +        ret = -ENOTSUP;
>      }
>  
> -    return -ENOTSUP;
> +    return ret;
>  }
>  
>  int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id)
> diff --git a/block.h b/block.h
> index 6abb687..31642c2 100644
> --- a/block.h
> +++ b/block.h
> @@ -324,7 +324,8 @@ int bdrv_snapshot_create(BlockDriverState *bs,
>                           QEMUSnapshotInfo *sn_info,
>                           Error **errp);
>  int bdrv_snapshot_goto(BlockDriverState *bs,
> -                       const char *snapshot_id);
> +                       const char *snapshot_id,
> +                       Error **errp);
>  int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id);
>  int bdrv_snapshot_list(BlockDriverState *bs,
>                         QEMUSnapshotInfo **psn_info);
> diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
> index 3fd8aff..e07f9ac 100644
> --- a/block/qcow2-snapshot.c
> +++ b/block/qcow2-snapshot.c
> @@ -428,7 +428,9 @@ fail:
>  }
>  
>  /* copy the snapshot 'snapshot_name' into the current disk image */
> -int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
> +int qcow2_snapshot_goto(BlockDriverState *bs,
> +                        const char *snapshot_id,
> +                        Error **errp)
>  {
>      BDRVQcowState *s = bs->opaque;
>      QCowSnapshot *sn;
> @@ -440,13 +442,14 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
>      /* Search the snapshot */
>      snapshot_index = find_snapshot_by_id_or_name(bs, snapshot_id);
>      if (snapshot_index < 0) {
> +        error_setg(errp, "Failed to find snapshot '%s' by id or name.",
> +                   snapshot_id);
>          return -ENOENT;
>      }
>      sn = &s->snapshots[snapshot_index];
>  
>      if (sn->disk_size != bs->total_sectors * BDRV_SECTOR_SIZE) {
> -        error_report("qcow2: Loading snapshots with different disk "
> -            "size is not implemented");
> +        error_setg(errp, "Not supported.");
>          ret = -ENOTSUP;
>          goto fail;
>      }
> @@ -458,6 +461,7 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
>       */
>      ret = qcow2_grow_l1_table(bs, sn->l1_size, true);
>      if (ret < 0) {
> +        error_setg(errp, "Failed to grow L1 table.");
>          goto fail;
>      }
>  
> @@ -476,18 +480,21 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
>  
>      ret = bdrv_pread(bs->file, sn->l1_table_offset, sn_l1_table, sn_l1_bytes);
>      if (ret < 0) {
> +        error_setg(errp, "Failed to load data into L1 table.");
>          goto fail;
>      }
>  
>      ret = qcow2_update_snapshot_refcount(bs, sn->l1_table_offset,
>                                           sn->l1_size, 1);
>      if (ret < 0) {
> +        error_setg(errp, "Failed to update snapshot refcount.");
>          goto fail;
>      }
>  
>      ret = bdrv_pwrite_sync(bs->file, s->l1_table_offset, sn_l1_table,
>                             cur_l1_bytes);
>      if (ret < 0) {
> +        error_setg(errp, "Failed to save L1 table.");
>          goto fail;
>      }
>  
> @@ -513,6 +520,7 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
>      }
>  
>      if (ret < 0) {
> +        error_setg(errp, "Failed to update snapshot refcount.");
>          goto fail;
>      }
>  
> @@ -525,6 +533,7 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
>       */
>      ret = qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1_size, 0);
>      if (ret < 0) {
> +        error_setg(errp, "Failed to update snapshot refcount.");
>          goto fail;
>      }
>  
> diff --git a/block/qcow2.h b/block/qcow2.h
> index 854bd12..6babb56 100644
> --- a/block/qcow2.h
> +++ b/block/qcow2.h
> @@ -311,7 +311,9 @@ int qcow2_zero_clusters(BlockDriverState *bs, uint64_t offset, int nb_sectors);
>  int qcow2_snapshot_create(BlockDriverState *bs,
>                            QEMUSnapshotInfo *sn_info,
>                            Error **errp);
> -int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id);
> +int qcow2_snapshot_goto(BlockDriverState *bs,
> +                        const char *snapshot_id,
> +                        Error **errp);
>  int qcow2_snapshot_delete(BlockDriverState *bs, const char *snapshot_id);
>  int qcow2_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab);
>  int qcow2_snapshot_load_tmp(BlockDriverState *bs, const char *snapshot_name);
> diff --git a/block/rbd.c b/block/rbd.c
> index cb5acf8..3e789c6 100644
> --- a/block/rbd.c
> +++ b/block/rbd.c
> @@ -858,12 +858,16 @@ static int qemu_rbd_snap_remove(BlockDriverState *bs,
>  }
>  
>  static int qemu_rbd_snap_rollback(BlockDriverState *bs,
> -                                  const char *snapshot_name)
> +                                  const char *snapshot_name,
> +                                  Error **errp)
>  {
>      BDRVRBDState *s = bs->opaque;
>      int r;
>  
>      r = rbd_snap_rollback(s->image, snapshot_name);
> +    if (r < 0) {
> +        error_setg(errp, "Failed to rollback snapshot.");
> +    }
>      return r;
>  }
>  
> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index 094634a..34ef75c 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -1808,7 +1808,9 @@ cleanup:
>      return ret;
>  }
>  
> -static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
> +static int sd_snapshot_goto(BlockDriverState *bs,
> +                            const char *snapshot_id,
> +                            Error **errp)
>  {
>      BDRVSheepdogState *s = bs->opaque;
>      BDRVSheepdogState *old_s;
> @@ -1833,14 +1835,14 @@ static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
>  
>      ret = find_vdi_name(s, vdi, snapid, tag, &vid, 1);
>      if (ret) {
> -        error_report("Failed to find_vdi_name");
> +        error_setg(errp, "Failed to find VDI snapshot '%s'.", vdi);
>          goto out;
>      }
>  
>      fd = connect_to_sdog(s->addr, s->port);
>      if (fd < 0) {
> -        error_report("failed to connect");
>          ret = fd;
> +        error_setg(errp, "Failed to connect to sdog.");
>          goto out;
>      }
>  
> @@ -1851,13 +1853,14 @@ static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
>      closesocket(fd);
>  
>      if (ret) {
> +        error_setg(errp, "Failed to open '%s'.", vdi);
>          goto out;
>      }
>  
>      memcpy(&s->inode, buf, sizeof(s->inode));
>  
>      if (!s->inode.vm_state_size) {
> -        error_report("Invalid snapshot");
> +        error_setg(errp, "Invalid snapshot '%s'.", snapshot_id);
>          ret = -ENOENT;
>          goto out;
>      }
> @@ -1873,9 +1876,6 @@ out:
>      memcpy(s, old_s, sizeof(BDRVSheepdogState));
>      g_free(buf);
>      g_free(old_s);
> -
> -    error_report("failed to open. recover old bdrv_sd_state.");
> -
>      return ret;
>  }
>  
> diff --git a/block_int.h b/block_int.h
> index 976ea1f..016782c 100644
> --- a/block_int.h
> +++ b/block_int.h
> @@ -150,7 +150,8 @@ struct BlockDriver {
>                                  QEMUSnapshotInfo *sn_info,
>                                  Error **errp);
>      int (*bdrv_snapshot_goto)(BlockDriverState *bs,
> -                              const char *snapshot_id);
> +                              const char *snapshot_id,
> +                              Error **errp);
>      int (*bdrv_snapshot_delete)(BlockDriverState *bs, const char *snapshot_id);
>      int (*bdrv_snapshot_list)(BlockDriverState *bs,
>                                QEMUSnapshotInfo **psn_info);
> diff --git a/qemu-img.c b/qemu-img.c
> index 93e4022..91671a8 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -1564,11 +1564,7 @@ static int img_snapshot(int argc, char **argv)
>          break;
>  
>      case SNAPSHOT_APPLY:
> -        ret = bdrv_snapshot_goto(bs, snapshot_name);
> -        if (ret) {
> -            error_report("Could not apply snapshot '%s': %d (%s)",
> -                snapshot_name, ret, strerror(-ret));
> -        }
> +        ret = bdrv_snapshot_goto(bs, snapshot_name, &err);
>          break;
>  
>      case SNAPSHOT_DELETE:
> diff --git a/savevm.c b/savevm.c
> index ef2f305..29e41fc 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -2301,7 +2301,7 @@ int load_vmstate(const char *name)
>      bs = NULL;
>      while ((bs = bdrv_next(bs))) {
>          if (bdrv_can_snapshot(bs)) {
> -            ret = bdrv_snapshot_goto(bs, name);
> +            ret = bdrv_snapshot_goto(bs, name, NULL);
>              if (ret < 0) {
>                  error_report("Error %d while activating snapshot '%s' on '%s'",
>                               ret, name, bdrv_get_device_name(bs));

Patch

diff --git a/block.c b/block.c
index fea429b..d012b0e 100644
--- a/block.c
+++ b/block.c
@@ -3098,29 +3098,34 @@  int bdrv_snapshot_create(BlockDriverState *bs,
 }
 
 int bdrv_snapshot_goto(BlockDriverState *bs,
-                       const char *snapshot_id)
+                       const char *snapshot_id,
+                       Error **errp)
 {
     BlockDriver *drv = bs->drv;
     int ret, open_ret;
 
-    if (!drv)
-        return -ENOMEDIUM;
-    if (drv->bdrv_snapshot_goto)
-        return drv->bdrv_snapshot_goto(bs, snapshot_id);
-
-    if (bs->file) {
+    if (!drv) {
+        error_setg(errp, "Device '%s' has no medium.",
+                   bdrv_get_device_name(bs));
+        ret = -ENOMEDIUM;
+    } else if (drv->bdrv_snapshot_goto) {
+        ret = drv->bdrv_snapshot_goto(bs, snapshot_id, errp);
+    } else if (bs->file) {
         drv->bdrv_close(bs);
-        ret = bdrv_snapshot_goto(bs->file, snapshot_id);
+        ret = bdrv_snapshot_goto(bs->file, snapshot_id, errp);
         open_ret = drv->bdrv_open(bs, bs->open_flags);
         if (open_ret < 0) {
             bdrv_delete(bs->file);
             bs->drv = NULL;
-            return open_ret;
+            error_setg(errp, "Failed to open '%s'.", bdrv_get_device_name(bs));
+            ret = open_ret;
         }
-        return ret;
+    } else {
+        error_setg(errp, "Not supported.");
+        ret = -ENOTSUP;
     }
 
-    return -ENOTSUP;
+    return ret;
 }
 
 int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id)
diff --git a/block.h b/block.h
index 6abb687..31642c2 100644
--- a/block.h
+++ b/block.h
@@ -324,7 +324,8 @@  int bdrv_snapshot_create(BlockDriverState *bs,
                          QEMUSnapshotInfo *sn_info,
                          Error **errp);
 int bdrv_snapshot_goto(BlockDriverState *bs,
-                       const char *snapshot_id);
+                       const char *snapshot_id,
+                       Error **errp);
 int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id);
 int bdrv_snapshot_list(BlockDriverState *bs,
                        QEMUSnapshotInfo **psn_info);
diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index 3fd8aff..e07f9ac 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -428,7 +428,9 @@  fail:
 }
 
 /* copy the snapshot 'snapshot_name' into the current disk image */
-int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
+int qcow2_snapshot_goto(BlockDriverState *bs,
+                        const char *snapshot_id,
+                        Error **errp)
 {
     BDRVQcowState *s = bs->opaque;
     QCowSnapshot *sn;
@@ -440,13 +442,14 @@  int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
     /* Search the snapshot */
     snapshot_index = find_snapshot_by_id_or_name(bs, snapshot_id);
     if (snapshot_index < 0) {
+        error_setg(errp, "Failed to find snapshot '%s' by id or name.",
+                   snapshot_id);
         return -ENOENT;
     }
     sn = &s->snapshots[snapshot_index];
 
     if (sn->disk_size != bs->total_sectors * BDRV_SECTOR_SIZE) {
-        error_report("qcow2: Loading snapshots with different disk "
-            "size is not implemented");
+        error_setg(errp, "Not supported.");
         ret = -ENOTSUP;
         goto fail;
     }
@@ -458,6 +461,7 @@  int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
      */
     ret = qcow2_grow_l1_table(bs, sn->l1_size, true);
     if (ret < 0) {
+        error_setg(errp, "Failed to grow L1 table.");
         goto fail;
     }
 
@@ -476,18 +480,21 @@  int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
 
     ret = bdrv_pread(bs->file, sn->l1_table_offset, sn_l1_table, sn_l1_bytes);
     if (ret < 0) {
+        error_setg(errp, "Failed to load data into L1 table.");
         goto fail;
     }
 
     ret = qcow2_update_snapshot_refcount(bs, sn->l1_table_offset,
                                          sn->l1_size, 1);
     if (ret < 0) {
+        error_setg(errp, "Failed to update snapshot refcount.");
         goto fail;
     }
 
     ret = bdrv_pwrite_sync(bs->file, s->l1_table_offset, sn_l1_table,
                            cur_l1_bytes);
     if (ret < 0) {
+        error_setg(errp, "Failed to save L1 table.");
         goto fail;
     }
 
@@ -513,6 +520,7 @@  int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
     }
 
     if (ret < 0) {
+        error_setg(errp, "Failed to update snapshot refcount.");
         goto fail;
     }
 
@@ -525,6 +533,7 @@  int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
      */
     ret = qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1_size, 0);
     if (ret < 0) {
+        error_setg(errp, "Failed to update snapshot refcount.");
         goto fail;
     }
 
diff --git a/block/qcow2.h b/block/qcow2.h
index 854bd12..6babb56 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -311,7 +311,9 @@  int qcow2_zero_clusters(BlockDriverState *bs, uint64_t offset, int nb_sectors);
 int qcow2_snapshot_create(BlockDriverState *bs,
                           QEMUSnapshotInfo *sn_info,
                           Error **errp);
-int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id);
+int qcow2_snapshot_goto(BlockDriverState *bs,
+                        const char *snapshot_id,
+                        Error **errp);
 int qcow2_snapshot_delete(BlockDriverState *bs, const char *snapshot_id);
 int qcow2_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab);
 int qcow2_snapshot_load_tmp(BlockDriverState *bs, const char *snapshot_name);
diff --git a/block/rbd.c b/block/rbd.c
index cb5acf8..3e789c6 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -858,12 +858,16 @@  static int qemu_rbd_snap_remove(BlockDriverState *bs,
 }
 
 static int qemu_rbd_snap_rollback(BlockDriverState *bs,
-                                  const char *snapshot_name)
+                                  const char *snapshot_name,
+                                  Error **errp)
 {
     BDRVRBDState *s = bs->opaque;
     int r;
 
     r = rbd_snap_rollback(s->image, snapshot_name);
+    if (r < 0) {
+        error_setg(errp, "Failed to rollback snapshot.");
+    }
     return r;
 }
 
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 094634a..34ef75c 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1808,7 +1808,9 @@  cleanup:
     return ret;
 }
 
-static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
+static int sd_snapshot_goto(BlockDriverState *bs,
+                            const char *snapshot_id,
+                            Error **errp)
 {
     BDRVSheepdogState *s = bs->opaque;
     BDRVSheepdogState *old_s;
@@ -1833,14 +1835,14 @@  static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
 
     ret = find_vdi_name(s, vdi, snapid, tag, &vid, 1);
     if (ret) {
-        error_report("Failed to find_vdi_name");
+        error_setg(errp, "Failed to find VDI snapshot '%s'.", vdi);
         goto out;
     }
 
     fd = connect_to_sdog(s->addr, s->port);
     if (fd < 0) {
-        error_report("failed to connect");
         ret = fd;
+        error_setg(errp, "Failed to connect to sdog.");
         goto out;
     }
 
@@ -1851,13 +1853,14 @@  static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
     closesocket(fd);
 
     if (ret) {
+        error_setg(errp, "Failed to open '%s'.", vdi);
         goto out;
     }
 
     memcpy(&s->inode, buf, sizeof(s->inode));
 
     if (!s->inode.vm_state_size) {
-        error_report("Invalid snapshot");
+        error_setg(errp, "Invalid snapshot '%s'.", snapshot_id);
         ret = -ENOENT;
         goto out;
     }
@@ -1873,9 +1876,6 @@  out:
     memcpy(s, old_s, sizeof(BDRVSheepdogState));
     g_free(buf);
     g_free(old_s);
-
-    error_report("failed to open. recover old bdrv_sd_state.");
-
     return ret;
 }
 
diff --git a/block_int.h b/block_int.h
index 976ea1f..016782c 100644
--- a/block_int.h
+++ b/block_int.h
@@ -150,7 +150,8 @@  struct BlockDriver {
                                 QEMUSnapshotInfo *sn_info,
                                 Error **errp);
     int (*bdrv_snapshot_goto)(BlockDriverState *bs,
-                              const char *snapshot_id);
+                              const char *snapshot_id,
+                              Error **errp);
     int (*bdrv_snapshot_delete)(BlockDriverState *bs, const char *snapshot_id);
     int (*bdrv_snapshot_list)(BlockDriverState *bs,
                               QEMUSnapshotInfo **psn_info);
diff --git a/qemu-img.c b/qemu-img.c
index 93e4022..91671a8 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1564,11 +1564,7 @@  static int img_snapshot(int argc, char **argv)
         break;
 
     case SNAPSHOT_APPLY:
-        ret = bdrv_snapshot_goto(bs, snapshot_name);
-        if (ret) {
-            error_report("Could not apply snapshot '%s': %d (%s)",
-                snapshot_name, ret, strerror(-ret));
-        }
+        ret = bdrv_snapshot_goto(bs, snapshot_name, &err);
         break;
 
     case SNAPSHOT_DELETE:
diff --git a/savevm.c b/savevm.c
index ef2f305..29e41fc 100644
--- a/savevm.c
+++ b/savevm.c
@@ -2301,7 +2301,7 @@  int load_vmstate(const char *name)
     bs = NULL;
     while ((bs = bdrv_next(bs))) {
         if (bdrv_can_snapshot(bs)) {
-            ret = bdrv_snapshot_goto(bs, name);
+            ret = bdrv_snapshot_goto(bs, name, NULL);
             if (ret < 0) {
                 error_report("Error %d while activating snapshot '%s' on '%s'",
                              ret, name, bdrv_get_device_name(bs));