From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkYps-0002H5-6p for qemu-devel@nongnu.org; Thu, 06 Jun 2013 07:58:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkYpr-0008T7-8Z for qemu-devel@nongnu.org; Thu, 06 Jun 2013 07:58:32 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:63818) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkYpr-0008Sv-2h for qemu-devel@nongnu.org; Thu, 06 Jun 2013 07:58:31 -0400 Received: by mail-pd0-f179.google.com with SMTP id q11so3226238pdj.24 for ; Thu, 06 Jun 2013 04:58:30 -0700 (PDT) From: Liu Yuan Date: Thu, 6 Jun 2013 19:57:29 +0800 Message-Id: <1370519849-10620-3-git-send-email-namei.unix@gmail.com> In-Reply-To: <1370519849-10620-1-git-send-email-namei.unix@gmail.com> References: <1370519849-10620-1-git-send-email-namei.unix@gmail.com> Subject: [Qemu-devel] [PATCH 2/2] sheepdog: support 'qemu-img snapshot -a' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: sheepdog@lists.wpkg.org Cc: Kevin Wolf , Stefan Hajnoczi , qemu-devel@nongnu.org, MORITA Kazutaka Just call sd_create_branch() to rollback the image is good enough Cc: qemu-devel@nongnu.org Cc: MORITA Kazutaka Cc: Kevin Wolf Cc: Stefan Hajnoczi Signed-off-by: Liu Yuan --- 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