]> git.proxmox.com Git - qemu.git/commit - block/sheepdog.c
sheepdog: support 'qemu-img snapshot -a'
authorLiu Yuan <namei.unix@gmail.com>
Fri, 7 Jun 2013 17:54:26 +0000 (01:54 +0800)
committerKevin Wolf <kwolf@redhat.com>
Mon, 17 Jun 2013 15:47:58 +0000 (17:47 +0200)
commitcede621ffc13ba1e209d9a21e85b21e150b74045
tree74ddc9ac96c4ff02d2f130722fad9062ee176a1d
parentb579ffb3fd64243b64ac5aaf659ac88518f17835
sheepdog: support 'qemu-img snapshot -a'

Just call sd_create_branch() in the snapshot_goto to rollback the image is good
enough. With this patch, 'loadvm' process for sheepdog is modified:

Suppose we have a snapshot chain A --> B --> C, we do 'loadvm A' so as to get
a new chain,

A --> B
|
V
C1

in the old code:

1 reload inode of A (in snapshot_goto)
2 read vmstate via A's vdi_id (loadvm_state)
3 delete C and create C1, reload inode of C1 (sd_create_branch on write)

with this patch applied:

1 reload inode of A, delete C and create C1  (in snapshot_goto)
2 read vmstate via C1's parent, that is A's vdi_id (loadvm_state)

This will fix the possible bug that QEMU exit between 2 and 3 in the old code

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 <namei.unix@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/sheepdog.c