From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkZak-0004CE-Qa for qemu-devel@nongnu.org; Thu, 06 Jun 2013 08:47:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkZaf-0000hJ-Lt for qemu-devel@nongnu.org; Thu, 06 Jun 2013 08:46:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkZaf-0000h4-EK for qemu-devel@nongnu.org; Thu, 06 Jun 2013 08:46:53 -0400 Date: Thu, 6 Jun 2013 14:46:29 +0200 From: Kevin Wolf Message-ID: <20130606124629.GE2586@dhcp-200-207.str.redhat.com> References: <1370519849-10620-1-git-send-email-namei.unix@gmail.com> <1370519849-10620-3-git-send-email-namei.unix@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1370519849-10620-3-git-send-email-namei.unix@gmail.com> Subject: Re: [Qemu-devel] [PATCH 2/2] sheepdog: support 'qemu-img snapshot -a' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Yuan Cc: Stefan Hajnoczi , sheepdog@lists.wpkg.org, qemu-devel@nongnu.org, MORITA Kazutaka Am 06.06.2013 um 13:57 hat Liu Yuan geschrieben: > 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; > + } > } I'm not sure how snapshots work internally for Sheepdog, but it seems odd to me that you need to do this only for disk-only snapshots, but not when the snapshot has VM state. (Also, note that 'qemu-img snapshot -a' works on images with a VM state, so the comment doesn't seem to be completely accurate) Would you mind explaining to me how this works in detail? Kevin