Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 2259187: osd: wait for the pgs to be clean #557

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions pkg/operator/ceph/cluster/osd/osd.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,20 +268,30 @@ func (c *Cluster) Start() error {
return errors.Wrapf(err, "failed to update ceph storage status")
}

if c.replaceOSD != nil {
delOpts := &k8sutil.DeleteOptions{MustDelete: true, WaitOptions: k8sutil.WaitOptions{Wait: true}}
err := k8sutil.DeleteConfigMap(c.clusterInfo.Context, c.context.Clientset, OSDReplaceConfigName, namespace, delOpts)
if err != nil {
return errors.Wrapf(err, "failed to delete the %q configmap", OSDReplaceConfigName)
if c.spec.Storage.Store.UpdateStore == OSDStoreUpdateConfirmation {
if c.replaceOSD != nil {
delOpts := &k8sutil.DeleteOptions{MustDelete: true, WaitOptions: k8sutil.WaitOptions{Wait: true}}
err := k8sutil.DeleteConfigMap(c.clusterInfo.Context, c.context.Clientset, OSDReplaceConfigName, namespace, delOpts)
if err != nil {
return errors.Wrapf(err, "failed to delete the %q configmap", OSDReplaceConfigName)
}
}

// Wait for PGs to be healthy before continuing the reconcile
_, err = c.waitForHealthyPGs()
// wait for the pgs to be healthy before attempting to migrate the next OSD
_, err := c.waitForHealthyPGs()
if err != nil {
return errors.Wrapf(err, "failed to wait for pgs to be healhty")
}

return errors.New("reconcile operator to replace OSDs that are pending migration")
// reconcile if migration of one or more OSD is pending.
osdsToReplace, err := c.getOSDWithNonMatchingStore()
if err != nil {
return errors.Wrapf(err, "failed to check if any OSD migration is pending")
}

if len(osdsToReplace) != 0 {
return errors.New("reconcile operator to replace OSDs that are pending migration")
}
}

logger.Infof("finished running OSDs in namespace %q", namespace)
Expand Down Expand Up @@ -846,7 +856,7 @@ func (c *Cluster) waitForHealthyPGs() (bool, error) {
if pgClean {
return true, nil
}
logger.Infof("waiting for PGs to be healthy after replacing an OSD, status: %q", pgHealthMsg)
logger.Infof("waiting for PGs to be healthy. PG status: %q", pgHealthMsg)
return false, nil
}

Expand Down
Loading