aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authoredison <edison@cloud.com>2010-09-21 19:58:41 -0700
committerKevin Wolf <kwolf@redhat.com>2010-10-22 14:49:35 +0200
commit51ef67270b1d10e1fcf3de7368dccad1ba0bf9d1 (patch)
treea06b3ce03bae7ed77a1e1e9bebc6ead157c7a4e5 /block.c
parenta58b8d5401b6064d52113f243456115d046bdd12 (diff)
downloadqemu-51ef67270b1d10e1fcf3de7368dccad1ba0bf9d1.zip
qemu-51ef67270b1d10e1fcf3de7368dccad1ba0bf9d1.tar.gz
qemu-51ef67270b1d10e1fcf3de7368dccad1ba0bf9d1.tar.bz2
Copy snapshots out of QCOW2 disk
In order to backup snapshots, created from QCOW2 iamge, we want to copy snapshots out of QCOW2 disk to a seperate storage. The following patch adds a new option in "qemu-img": qemu-img convert -f qcow2 -O qcow2 -s snapshot_name src_img bck_img. Right now, it only supports to copy the full snapshot, delta snapshot is on the way. Changes from V1: all the comments from Kevin are addressed: Add read-only checking Fix coding style Change the name from bdrv_snapshot_load to bdrv_snapshot_load_tmp Signed-off-by: Disheng Su <edison@cloud.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/block.c b/block.c
index a19374d..985d0b7 100644
--- a/block.c
+++ b/block.c
@@ -1899,6 +1899,22 @@ int bdrv_snapshot_list(BlockDriverState *bs,
return -ENOTSUP;
}
+int bdrv_snapshot_load_tmp(BlockDriverState *bs,
+ const char *snapshot_name)
+{
+ BlockDriver *drv = bs->drv;
+ if (!drv) {
+ return -ENOMEDIUM;
+ }
+ if (!bs->read_only) {
+ return -EINVAL;
+ }
+ if (drv->bdrv_snapshot_load_tmp) {
+ return drv->bdrv_snapshot_load_tmp(bs, snapshot_name);
+ }
+ return -ENOTSUP;
+}
+
#define NB_SUFFIXES 4
char *get_human_readable_size(char *buf, int buf_size, int64_t size)