[sheepdog] [PATCH 2/2] sheepdog: support 'qemu-img snapshot -a'

Liu Yuan namei.unix at gmail.com
Thu Jun 6 13:57:29 CEST 2013


Just call sd_create_branch() to rollback the image is good enough

Cc: qemu-devel at nongnu.org
Cc: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf at redhat.com>
Cc: Stefan Hajnoczi <stefanha at redhat.com>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 block/sheepdog.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 94218ac..cb5ca4a 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -2072,9 +2072,11 @@ static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
     }
 
     if (!s->inode.vm_state_size) {
-        error_report("Invalid snapshot");
-        ret = -ENOENT;
-        goto out;
+        /* qemu-img asks us to rollback, we need to do it right now */
+        ret = sd_create_branch(s);
+        if (ret) {
+            goto out;
+        }
     }
 
     s->is_snapshot = true;
-- 
1.7.9.5




More information about the sheepdog mailing list