ceph: update OSDs reconcile

OSDs not automatically started when adding nodes to existing cluster.
Call the helper NormalizeCrushName(name) to make sure the node name can match the name in the crush map before querying for the node in the crush map, and reconcile when new nodes get added.

Closes: https://github.com/rook/rook/issues/7462
Signed-off-by: parth-gr <partharora1010@gmail.com>
This commit is contained in:
parth-gr authored and parth-gr committed 2021-04-22 20:40:14 +05:30
1 parent a9641a9355
commit f6bd25ae01
2 files changed
+3 -5

No files matched your search

+1
View File
@@ -199,6 +199,7 @@ func formatProperty(name, value string) string {
// GetOSDOnHost returns the list of osds running on a given host
func GetOSDOnHost(context *clusterd.Context, clusterInfo *ClusterInfo, node string) (string, error) {
node = NormalizeCrushName(node)
args := []string{"osd", "crush", "ls", node}
buf, err := NewCephCommand(context, clusterInfo, args).Run()
if err != nil {
+2 -5
View File
@@ -94,17 +94,14 @@ func (c *clientCluster) onK8sNode(object runtime.Object) bool {
osds, err := cephclient.GetOSDOnHost(c.context, clusterInfo, nodeName)
if err != nil {
// If it fails, this might be due to the the operator just starting and catching an add event for that node
logger.Debugf("failed to get osds on node %q", nodeName)
return false
logger.Debugf("failed to get osds on node %q, assume reconcile is necessary", nodeName)
return true
}
// If they are OSDs in the CRUSH map and if the host exists in the CRUSH map, don't reconcile
if osds != "" {
// This is Debug level because the node receives frequent updates and this will pollute the logs
logger.Debugf("node watcher: node %q is already an OSD node with %q", nodeName, osds)
} else {
logger.Infof("node watcher: adding node %q to cluster %q", node.Labels[v1.LabelHostname], cluster.Namespace)
return true
}
}