osd: support loop devices for test clusters

A new variable is added to rook-ceph-operator-config
ConfigMap to allow using loop devices for osd.

This feature is intended to be used for testing purposes only.

Signed-off-by: Shinya Hayashi <shinya-hayashi@cybozu.co.jp>
(cherry picked from commit 05875a3f4f)
This commit is contained in:
Shinya Hayashi authored and Mergify committed 2022-11-10 18:31:43 +00:00
1 parent 8787dab0a1
commit 13b63c4a08
19 files changed
+294 -6

No files matched your search

@@ -82,6 +82,9 @@ var (
// OperatorCephBaseImageVersion is the ceph version in the operator image
OperatorCephBaseImageVersion string
// loopDevicesAllowed indicates whether loop devices are allowed to be used
loopDevicesAllowed = false
)
func DiscoveryDaemonEnabled(data map[string]string) bool {
@@ -99,6 +102,20 @@ func SetCephCommandsTimeout(data map[string]string) {
exec.CephCommandsTimeout = time.Duration(timeoutSeconds) * time.Second
}
func SetAllowLoopDevices(data map[string]string) {
strLoopDevicesAllowed := k8sutil.GetValue(data, "ROOK_CEPH_ALLOW_LOOP_DEVICES", "false")
var err error
loopDevicesAllowed, err = strconv.ParseBool(strLoopDevicesAllowed)
if err != nil {
logger.Warningf("ROOK_CEPH_ALLOW_LOOP_DEVICES is set to an invalid value %v, set the default value false", strLoopDevicesAllowed)
loopDevicesAllowed = false
}
}
func LoopDevicesAllowed() bool {
return loopDevicesAllowed
}
// canIgnoreHealthErrStatusInReconcile determines whether a status of HEALTH_ERR in the CephCluster can be ignored safely.
func canIgnoreHealthErrStatusInReconcile(cephCluster cephv1.CephCluster, controllerName string) bool {
// Get a list of all the keys causing the HEALTH_ERR status.