rbd: add String method for MirrorMode

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2021-03-17 15:52:19 -04:00 committed by mergify[bot]
parent d75b75fb75
commit 406868763c

View File

@ -31,6 +31,20 @@ const (
MirrorModePool = MirrorMode(C.RBD_MIRROR_MODE_POOL) MirrorModePool = MirrorMode(C.RBD_MIRROR_MODE_POOL)
) )
// String representation of MirrorMode.
func (m MirrorMode) String() string {
switch m {
case MirrorModeDisabled:
return "disabled"
case MirrorModeImage:
return "image"
case MirrorModePool:
return "pool"
default:
return "<unknown>"
}
}
// ImageMirrorMode is used to indicate the mirroring approach for an RBD image. // ImageMirrorMode is used to indicate the mirroring approach for an RBD image.
type ImageMirrorMode int64 type ImageMirrorMode int64