mirror of
https://github.com/ceph/go-ceph
synced 2024-12-23 06:33:24 +00:00
005aa73667
Signed-off-by: Sven Anderson <sven@redhat.com>
38 lines
676 B
Go
38 lines
676 B
Go
package util
|
|
|
|
import "os"
|
|
|
|
// CephVersion type
|
|
type CephVersion int
|
|
|
|
// Enum of known CephVersions
|
|
const (
|
|
CephNautilus CephVersion = 14 + iota
|
|
CephOctopus
|
|
CephPacific
|
|
CephQuincy
|
|
CephUnknown
|
|
)
|
|
|
|
// CurrentCephVersion is the current Ceph version
|
|
func CurrentCephVersion() CephVersion {
|
|
vname := os.Getenv("CEPH_VERSION")
|
|
return CephVersionOfString(vname)
|
|
}
|
|
|
|
// CephVersionOfString converts a string to CephVersion
|
|
func CephVersionOfString(vname string) CephVersion {
|
|
switch vname {
|
|
case "nautilus":
|
|
return CephNautilus
|
|
case "octopus":
|
|
return CephOctopus
|
|
case "pacific":
|
|
return CephPacific
|
|
case "quincy":
|
|
return CephQuincy
|
|
default:
|
|
return CephUnknown
|
|
}
|
|
}
|