diff --git a/pkg/daemon/ceph/client/mirror_health.go b/pkg/daemon/ceph/client/mirror_health.go index 6e49984b6..0b12ca7c9 100644 --- a/pkg/daemon/ceph/client/mirror_health.go +++ b/pkg/daemon/ceph/client/mirror_health.go @@ -180,7 +180,10 @@ func updateRadosNamespaceStatusMirroring(c *mirrorChecker, mirrorStatus *cephv1. if blockPool.Spec.StatusCheck.Mirror.Disabled { logger.Debugf("mirroring status check is disabled for %q", c.namespacedName.Name) - return + mirrorStatus = nil + mirrorInfo = nil + snapSchedStatus = nil + details = "" } // Update the CephBlockPoolRadosNamespace CR status field @@ -222,7 +225,7 @@ func toCustomResourceStatus(currentStatus *cephv1.MirroringStatusSpec, mirroring mirroringInfoSpec.Details = details if currentInfo != nil { - mirroringInfoSpec.LastChanged = currentInfo.LastChecked + mirroringInfoSpec.LastChanged = currentInfo.LastChanged } // snapSchedStatus will be nil in case of an error to fetch it @@ -234,7 +237,7 @@ func toCustomResourceStatus(currentStatus *cephv1.MirroringStatusSpec, mirroring snapshotScheduleStatusSpec.Details = details if currentSnapSchedStatus != nil { - snapshotScheduleStatusSpec.LastChanged = currentSnapSchedStatus.LastChecked + snapshotScheduleStatusSpec.LastChanged = currentSnapSchedStatus.LastChanged } return mirroringStatusSpec, mirroringInfoSpec, snapshotScheduleStatusSpec diff --git a/pkg/operator/ceph/pool/controller.go b/pkg/operator/ceph/pool/controller.go index 5082c2cb0..eec0bda1b 100644 --- a/pkg/operator/ceph/pool/controller.go +++ b/pkg/operator/ceph/pool/controller.go @@ -392,9 +392,9 @@ func (r *ReconcileCephBlockPool) reconcile(request reconcile.Request) (reconcile if blockPoolContextsExists && r.blockPoolContexts[blockPoolChannelKey].started { logger.Info("stop monitoring the mirroring status of the pool %q", cephBlockPool.Name) r.cancelMirrorMonitoring(cephBlockPool) - // Reset the MirrorHealthCheckSpec - checker.UpdateStatusMirroring(nil, nil, nil, "") } + // Reset the MirrorHealthCheckSpec + checker.UpdateStatusMirroring(nil, nil, nil, "") } else { // Start monitoring of the pool if r.blockPoolContexts[blockPoolChannelKey].started { @@ -423,9 +423,9 @@ func (r *ReconcileCephBlockPool) reconcile(request reconcile.Request) (reconcile // Stop monitoring the mirroring status of this pool if blockPoolContextsExists && r.blockPoolContexts[blockPoolChannelKey].started { r.cancelMirrorMonitoring(cephBlockPool) - // Reset the MirrorHealthCheckSpec - checker.UpdateStatusMirroring(nil, nil, nil, "") } + // Reset the MirrorHealthCheckSpec + checker.UpdateStatusMirroring(nil, nil, nil, "") } if statusErr != nil { diff --git a/pkg/operator/ceph/pool/controller_test.go b/pkg/operator/ceph/pool/controller_test.go index 396c129c8..7c334bbb2 100644 --- a/pkg/operator/ceph/pool/controller_test.go +++ b/pkg/operator/ceph/pool/controller_test.go @@ -562,7 +562,7 @@ func TestCephBlockPoolController(t *testing.T) { err = r.client.Get(context.TODO(), req.NamespacedName, pool) assert.NoError(t, err) assert.Equal(t, cephv1.ConditionReady, pool.Status.Phase) - assert.Nil(t, pool.Status.MirroringStatus) + assert.Equal(t, pool.Status.MirroringStatus, &cephv1.MirroringStatusSpec{}) }) } diff --git a/pkg/operator/ceph/pool/radosnamespace/controller.go b/pkg/operator/ceph/pool/radosnamespace/controller.go index 36551305a..3765f846b 100644 --- a/pkg/operator/ceph/pool/radosnamespace/controller.go +++ b/pkg/operator/ceph/pool/radosnamespace/controller.go @@ -594,9 +594,9 @@ func (r *ReconcileCephBlockPoolRadosNamespace) reconcileMirroring(cephBlockPoolR // Stop monitoring the mirroring status of this radosNamespace if radosNamespaceContextsExists && r.radosNamespaceContexts[radosNamespaceChannelKey].started { r.cancelMirrorMonitoring(radosNamespaceChannelKey) - // Reset the MirrorHealthCheckSpec - checker.UpdateStatusMirroring(nil, nil, nil, "") } + // Reset the MirrorHealthCheckSpec + checker.UpdateStatusMirroring(nil, nil, nil, "") } return nil