From f84140356ae7cfc81cc302504f7ffb65bc8ad251 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Tue, 6 Apr 2021 13:38:31 -0400 Subject: [PATCH] rbd: add CreateMirrorSnapshot implementing rbd_mirror_image_create_snapshot This function is used to "manually" trigger a snapshot for snapshot based mirroring. It is needed as a pre-req to test actual cross-cluster mirroring and the full functionality of GetGlobalMirrorStatus. Signed-off-by: John Mulligan --- rbd/mirror.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/rbd/mirror.go b/rbd/mirror.go index 8a46cf6..ddfe47e 100644 --- a/rbd/mirror.go +++ b/rbd/mirror.go @@ -408,3 +408,16 @@ func (image *Image) GetGlobalMirrorStatus() (GlobalMirrorImageStatus, error) { } return status, nil } + +// CreateMirrorSnapshot creates a snapshot for image propagation to mirrors. +// +// Implements: +// int rbd_mirror_image_create_snapshot(rbd_image_t image, +// uint64_t *snap_id); +func (image *Image) CreateMirrorSnapshot() (uint64, error) { + var snapID C.uint64_t + ret := C.rbd_mirror_image_create_snapshot( + image.image, + &snapID) + return uint64(snapID), getError(ret) +}