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 <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2021-04-06 13:38:31 -04:00 committed by mergify[bot]
parent 0946b9e0e2
commit f84140356a
1 changed files with 13 additions and 0 deletions

View File

@ -408,3 +408,16 @@ func (image *Image) GetGlobalMirrorStatus() (GlobalMirrorImageStatus, error) {
} }
return status, nil 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)
}