ceph: remove DaemonType type

This type was a string already and was just making us doing string()
calls all the time to it's not worth it.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2020-04-01 09:08:18 +02:00
1 parent 7788901a88
commit 040193bb5a
21 files changed
+44 -66

No files matched your search

+7 -10
View File
@@ -32,30 +32,27 @@ import (
var logger = capnslog.NewPackageLogger("github.com/rook/rook", "op-config")
// DaemonType defines the type of a daemon. e.g., mon, mgr, osd, mds, rgw
type DaemonType string
const (
// MonType defines the mon DaemonType
MonType DaemonType = "mon"
MonType = "mon"
// MgrType defines the mgr DaemonType
MgrType DaemonType = "mgr"
MgrType = "mgr"
// OsdType defines the osd DaemonType
OsdType DaemonType = "osd"
OsdType = "osd"
// MdsType defines the mds DaemonType
MdsType DaemonType = "mds"
MdsType = "mds"
// RgwType defines the rgw DaemonType
RgwType DaemonType = "rgw"
RgwType = "rgw"
// RbdMirrorType defines the rbd-mirror DaemonType
RbdMirrorType DaemonType = "rbd-mirror"
RbdMirrorType = "rbd-mirror"
// CrashType defines the crash collector DaemonType
CrashType DaemonType = "crashcollector"
CrashType = "crashcollector"
// CephUser is the Linux Ceph username
CephUser = "ceph"
+4 -4
View File
@@ -52,7 +52,7 @@ type DataPathMap struct {
// which may include data from other daemons.
func NewStatefulDaemonDataPathMap(
dataDirHostPath, daemonDataDirHostRelativePath string,
daemonType DaemonType, daemonID, namespace string,
daemonType, daemonID, namespace string,
) *DataPathMap {
return &DataPathMap{
HostDataDir: path.Join(dataDirHostPath, daemonDataDirHostRelativePath),
@@ -64,7 +64,7 @@ func NewStatefulDaemonDataPathMap(
// NewStatelessDaemonDataPathMap returns a new DataPathMap for a daemon which does not persist data
// to the host (mgrs, mdses, rgws)
func NewStatelessDaemonDataPathMap(
daemonType DaemonType, daemonID, namespace, dataDirHostPath string,
daemonType, daemonID, namespace, dataDirHostPath string,
) *DataPathMap {
return &DataPathMap{
HostDataDir: "",
@@ -83,9 +83,9 @@ func NewDatalessDaemonDataPathMap(namespace, dataDirHostPath string) *DataPathMa
}
}
func cephDataDir(daemonType DaemonType, daemonID string) string {
func cephDataDir(daemonType, daemonID string) string {
// daemons' default data dirs are: /var/lib/ceph/<daemon-type>/ceph-<daemon-id>
return path.Join(VarLibCephDir, string(daemonType), "ceph-"+daemonID)
return path.Join(VarLibCephDir, daemonType, "ceph-"+daemonID)
}
// ContainerCrashDir returns the directory of the crash collector