aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Farnum <gregory.farnum@dreamhost.com>2012-01-11 11:53:52 -0800
committerKevin Wolf <kwolf@redhat.com>2012-01-26 11:39:03 +0100
commitbd6032470631d8d5de6db84ecb55398b70d9d2f3 (patch)
tree31eeb1380b24b09ccc83f122ce296032a7073c92
parent331636431af32ece373f4b1fb7c3ae9d0615e2a6 (diff)
rbd: wire up snapshot removal and rollback functionality
Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block/rbd.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/block/rbd.c b/block/rbd.c
index db5abf240b..46a8579018 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -789,6 +789,26 @@ static int qemu_rbd_snap_create(BlockDriverState *bs,
return 0;
}
+static int qemu_rbd_snap_remove(BlockDriverState *bs,
+ const char *snapshot_name)
+{
+ BDRVRBDState *s = bs->opaque;
+ int r;
+
+ r = rbd_snap_remove(s->image, snapshot_name);
+ return r;
+}
+
+static int qemu_rbd_snap_rollback(BlockDriverState *bs,
+ const char *snapshot_name)
+{
+ BDRVRBDState *s = bs->opaque;
+ int r;
+
+ r = rbd_snap_rollback(s->image, snapshot_name);
+ return r;
+}
+
static int qemu_rbd_snap_list(BlockDriverState *bs,
QEMUSnapshotInfo **psn_tab)
{
@@ -862,7 +882,9 @@ static BlockDriver bdrv_rbd = {
.bdrv_co_flush_to_disk = qemu_rbd_co_flush,
.bdrv_snapshot_create = qemu_rbd_snap_create,
+ .bdrv_snapshot_delete = qemu_rbd_snap_remove,
.bdrv_snapshot_list = qemu_rbd_snap_list,
+ .bdrv_snapshot_goto = qemu_rbd_snap_rollback,
};
static void bdrv_rbd_init(void)