rbd: add String method for ImageMirrorMode

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2021-03-17 15:52:45 -04:00 committed by mergify[bot]
parent 406868763c
commit 741e7d43bd
1 changed files with 12 additions and 0 deletions

View File

@ -57,6 +57,18 @@ const (
ImageMirrorModeSnapshot = ImageMirrorMode(C.RBD_MIRROR_IMAGE_MODE_SNAPSHOT)
)
// String representation of ImageMirrorMode.
func (imm ImageMirrorMode) String() string {
switch imm {
case ImageMirrorModeJournal:
return "journal"
case ImageMirrorModeSnapshot:
return "snapshot"
default:
return "<unknown>"
}
}
// SetMirrorMode is used to enable or disable pool level mirroring with either
// an automatic or per-image behavior.
//