From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVLsy-0008Ie-2l for qemu-devel@nongnu.org; Thu, 25 Apr 2013 09:06:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVLsr-0000L5-Mr for qemu-devel@nongnu.org; Thu, 25 Apr 2013 09:06:52 -0400 Received: from mail-da0-x22c.google.com ([2607:f8b0:400e:c00::22c]:55063) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVLsr-0000Ku-GZ for qemu-devel@nongnu.org; Thu, 25 Apr 2013 09:06:45 -0400 Received: by mail-da0-f44.google.com with SMTP id z20so1424350dae.3 for ; Thu, 25 Apr 2013 06:06:44 -0700 (PDT) Date: Thu, 25 Apr 2013 22:06:39 +0900 Message-ID: From: MORITA Kazutaka In-Reply-To: <1366894179-9350-1-git-send-email-namei.unix@gmail.com> References: <1366822079-6582-1-git-send-email-namei.unix@gmail.com> <1366894179-9350-1-git-send-email-namei.unix@gmail.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Subject: Re: [Qemu-devel] [sheepdog] [PATCH v4] sheepdog: fix loadvm operation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Yuan Cc: Kevin Wolf , sheepdog@lists.wpkg.org, qemu-devel@nongnu.org, Stefan Hajnoczi At Thu, 25 Apr 2013 20:49:39 +0800, Liu Yuan wrote: > > From: Liu Yuan > > Currently the 'loadvm' opertaion works as following: > 1. switch to the snapshot > 2. mark current working VDI as a snapshot > 3. rely on sd_create_branch to create a new working VDI based on the snapshot > > This works not the same as other format as QCOW2. For e.g, > > qemu > savevm # get a live snapshot snap1 > qemu > savevm # snap2 > qemu > loadvm 1 # This will steally create snap3 of the working VDI > > Which will result in following snapshot chain: > > base <-- snap1 <-- snap2 <-- snap3 > ^ > | > working VDI > > snap3 was unnecessarily created and might be annoying users. > > This patch discard the unnecessary 'snap3' creation. and implement > rollback(loadvm) operation to the specified snapshot by > 1. switch to the snapshot > 2. delete working VDI > 3. rely on sd_create_branch to create a new working VDI based on the snapshot > > The snapshot chain for above example will be: > > base <-- snap1 <-- snap2 > ^ > | > working VDI > > Cc: qemu-devel@nongnu.org > Cc: MORITA Kazutaka > Cc: Kevin Wolf > Cc: Stefan Hajnoczi > Signed-off-by: Liu Yuan > --- > v4: > - print an error message when NO_VDI found > > v3: > - let boot from snapshot behave like 'loadvm' > > v2: > - use do_req() because sd_delete isn't in coroutine > - don't break old behavior if we boot up on the snapshot by using s->reverted > to indicate if we delete working VDI successfully > - fix a subtle case that sd_create_branch() isn't called yet while another > 'loadvm' is executed > > block/sheepdog.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 53 insertions(+), 1 deletion(-) Reviewed-by: MORITA Kazutaka