rbd: wire up snapshot removal and rollback functionality Signed-off-by: Greg Farnum <gregory.farnum@xxxxxxxxxxxxx> Reviewed-by: Josh Durgin <josh.durgin@xxxxxxxxxxxxx> --- block/rbd.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index 7a2384c..f52c1ca 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -787,6 +787,36 @@ 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); + if (r < 0) { + error_report("failed to remove snap: %s", strerror(-r)); + return r; + } + + return 0; +} + +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); + if (r < 0) { + error_report("failed to rollback to snap: %s", strerror(-r)); + return r; + } + + return 0; +} + static int qemu_rbd_snap_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) { @@ -860,7 +890,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) -- 1.7.2.5 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html