Ceph: Ensure draining state is set and checked correctly.

- Checking whether drain was incorrectly checked precense in map instead
  of string length. The actual zero value was an empty string.
- Unsetting drain did not check if the cluster was clean.

Signed-off-by: Rohan CJ <rohantmp@gmail.com>
This commit is contained in:
Rohan CJ committed 2019-11-14 13:20:55 +05:30
1 parent b24a1e545e
commit e51e9f3ec9
2 files changed
+3 -3

No files matched your search

@@ -178,7 +178,7 @@ func (r *ReconcileClusterDisruption) reconcilePDBsForOSDs(
if clean {
pdbStateMap.Data[disabledPDBKey] = drainingFailureDomains[0]
}
} else {
} else if clean {
pdbStateMap.Data[disabledPDBKey] = ""
}
@@ -183,8 +183,8 @@ func (r *ReconcileClusterDisruption) reconcile(request reconcile.Request) (recon
if err != nil {
return reconcile.Result{}, err
}
_, ok := pdbStateMap.Data[disabledPDBKey]
if ok {
disabledPDB, ok := pdbStateMap.Data[disabledPDBKey]
if ok && len(disabledPDB) > 0 {
return reconcile.Result{Requeue: true, RequeueAfter: 30 * time.Second}, nil
}
return reconcile.Result{}, nil