ceph: fix error message in UpdateNodeStatus

The error message in UpdateNodeStatus regards the second argument
as node name. However, it is a PVC name in OSD on PVC.

Signed-off-by: Hiroya Onoe <onoehiroya@gmail.com>
This commit is contained in:
Hiroya Onoe committed 2021-09-02 02:43:16 +00:00
1 parent d577feac6d
commit 2ff5413b75
4 files changed
+14 -14

No files matched your search

+1 -1
View File
@@ -238,7 +238,7 @@ func prepareOSD(cmd *cobra.Command, args []string) error {
Message: err.Error(),
PvcBackedOSD: cfg.pvcBacked,
}
oposd.UpdateNodeStatus(kv, cfg.nodeName, status)
oposd.UpdateNodeOrPVCStatus(kv, cfg.nodeName, status)
rook.TerminateFatal(err)
}
+4 -4
View File
@@ -180,7 +180,7 @@ func Provision(context *clusterd.Context, agent *OsdAgent, crushLocation, topolo
// set the initial orchestration status
status := oposd.OrchestrationStatus{Status: oposd.OrchestrationStatusOrchestrating}
oposd.UpdateNodeStatus(agent.kv, agent.nodeName, status)
oposd.UpdateNodeOrPVCStatus(agent.kv, agent.nodeName, status)
if err := client.WriteCephConfig(context, agent.clusterInfo); err != nil {
return errors.Wrap(err, "failed to generate ceph config")
@@ -221,7 +221,7 @@ func Provision(context *clusterd.Context, agent *OsdAgent, crushLocation, topolo
// orchestration is about to start, update the status
status = oposd.OrchestrationStatus{Status: oposd.OrchestrationStatusOrchestrating, PvcBackedOSD: agent.pvcBacked}
oposd.UpdateNodeStatus(agent.kv, agent.nodeName, status)
oposd.UpdateNodeOrPVCStatus(agent.kv, agent.nodeName, status)
// start the desired OSDs on devices
logger.Infof("configuring osd devices: %+v", devices)
@@ -238,7 +238,7 @@ func Provision(context *clusterd.Context, agent *OsdAgent, crushLocation, topolo
if len(deviceOSDs) == 0 {
logger.Warningf("skipping OSD configuration as no devices matched the storage settings for this node %q", agent.nodeName)
status = oposd.OrchestrationStatus{OSDs: deviceOSDs, Status: oposd.OrchestrationStatusCompleted, PvcBackedOSD: agent.pvcBacked}
oposd.UpdateNodeStatus(agent.kv, agent.nodeName, status)
oposd.UpdateNodeOrPVCStatus(agent.kv, agent.nodeName, status)
return nil
}
@@ -278,7 +278,7 @@ func Provision(context *clusterd.Context, agent *OsdAgent, crushLocation, topolo
// orchestration is completed, update the status
status = oposd.OrchestrationStatus{OSDs: deviceOSDs, Status: oposd.OrchestrationStatusCompleted, PvcBackedOSD: agent.pvcBacked}
oposd.UpdateNodeStatus(agent.kv, agent.nodeName, status)
oposd.UpdateNodeOrPVCStatus(agent.kv, agent.nodeName, status)
return nil
}
+7 -7
View File
@@ -99,7 +99,7 @@ func (e *provisionErrors) asMessages() string {
// return name of status ConfigMap
func (c *Cluster) updateOSDStatus(node string, status OrchestrationStatus) string {
return UpdateNodeStatus(c.kv, node, status)
return UpdateNodeOrPVCStatus(c.kv, node, status)
}
func statusConfigMapLabels(node string) map[string]string {
@@ -110,14 +110,14 @@ func statusConfigMapLabels(node string) map[string]string {
}
}
// UpdateNodeStatus updates the status ConfigMap for the OSD on the given node. It returns the name
// UpdateNodeOrPVCStatus updates the status ConfigMap for the OSD on the given node or PVC. It returns the name
// the ConfigMap used.
func UpdateNodeStatus(kv *k8sutil.ConfigMapKVStore, node string, status OrchestrationStatus) string {
labels := statusConfigMapLabels(node)
func UpdateNodeOrPVCStatus(kv *k8sutil.ConfigMapKVStore, nodeOrPVC string, status OrchestrationStatus) string {
labels := statusConfigMapLabels(nodeOrPVC)
// update the status map with the given status now
s, _ := json.Marshal(status)
cmName := statusConfigMapName(node)
cmName := statusConfigMapName(nodeOrPVC)
if err := kv.SetValueWithLabels(
cmName,
orchestrationStatusKey,
@@ -125,7 +125,7 @@ func UpdateNodeStatus(kv *k8sutil.ConfigMapKVStore, node string, status Orchestr
labels,
); err != nil {
// log the error, but allow the orchestration to continue even if the status update failed
logger.Errorf("failed to set node %q status to %q for osd orchestration. %s", node, status.Status, status.Message)
logger.Errorf("failed to set node or PVC %q status to %q for osd orchestration. %s", nodeOrPVC, status.Status, status.Message)
}
return cmName
}
@@ -133,7 +133,7 @@ func UpdateNodeStatus(kv *k8sutil.ConfigMapKVStore, node string, status Orchestr
func (c *Cluster) handleOrchestrationFailure(errors *provisionErrors, nodeName, message string, args ...interface{}) {
errors.addError(message, args...)
status := OrchestrationStatus{Status: OrchestrationStatusFailed, Message: message}
UpdateNodeStatus(c.kv, nodeName, status)
UpdateNodeOrPVCStatus(c.kv, nodeName, status)
}
func parseOrchestrationStatus(data map[string]string) *OrchestrationStatus {
+2 -2
View File
@@ -56,7 +56,7 @@ func TestOrchestrationStatus(t *testing.T) {
// update the status map with some status
status := OrchestrationStatus{Status: OrchestrationStatusOrchestrating, Message: "doing work"}
UpdateNodeStatus(kv, nodeName, status)
UpdateNodeOrPVCStatus(kv, nodeName, status)
// retrieve the status and verify it
statusMap, err := c.context.Clientset.CoreV1().ConfigMaps(c.clusterInfo.Namespace).Get(ctx, cmName, metav1.GetOptions{})
@@ -94,7 +94,7 @@ func mockNodeOrchestrationCompletion(c *Cluster, nodeName string, statusMapWatch
},
Status: OrchestrationStatusCompleted,
}
UpdateNodeStatus(c.kv, nodeName, *status)
UpdateNodeOrPVCStatus(c.kv, nodeName, *status)
// 2) call modify on the fake watcher so a watch event will get triggered
s, _ := json.Marshal(status)