]> git.proxmox.com Git - qemu.git/commit - block/sheepdog.c
sheepdog: fix loadvm operation
authorLiu Yuan <tailai.ly@taobao.com>
Thu, 25 Apr 2013 12:49:39 +0000 (20:49 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 26 Apr 2013 11:37:51 +0000 (13:37 +0200)
commit859e5553a428225de6b8ef302cdcfd68d140b926
tree0750e8e83959971d3657a84aed2d9e4d4e2fd588
parent13c31de2fdd534c065ce4710f6e8df3921e98c4f
sheepdog: fix loadvm operation

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 <morita.kazutaka@lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Reviewed-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/sheepdog.c