Patchwork [RFC,V7,12/13] quorum: Add quorum_snapshot_reopen.

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

Comments

Benoît Canet - Jan. 28, 2013, 1:22 p.m.
Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 block/quorum.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Patch

diff --git a/block/quorum.c b/block/quorum.c
index 0217593..d6fef58 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -797,6 +797,25 @@  free_new_s_exit:
     quorum_free(&new_s);
 }
 
+static int quorum_snapshot_reopen(BlockDriverState *bs, int bdrv_flags,
+                                  Error **errp)
+{
+    BDRVQuorumState *s = bs->file->opaque;
+    int i, ret = -1;
+    Error *local_err = NULL;
+    BlockReopenQueue *queue = NULL;
+
+    for (i = 0; i < s->total; i++) {
+        queue = bdrv_reopen_queue(queue, s->bs[i], bdrv_flags);
+    }
+
+    ret = bdrv_reopen_multiple(queue, &local_err);
+    if (local_err != NULL) {
+        error_propagate(errp, local_err);
+    }
+    return ret;
+}
+
 static BlockDriver bdrv_quorum = {
     .format_name        = "quorum",
     .protocol_name      = "quorum",
@@ -813,6 +832,7 @@  static BlockDriver bdrv_quorum = {
     .bdrv_co_is_allocated  = quorum_co_is_allocated,
 
     .bdrv_ext_snapshot_img_create = quorum_snapshot_img_create,
+    .bdrv_ext_snapshot_reopen = quorum_snapshot_reopen,
 };
 
 static void bdrv_quorum_init(void)