osd: exclude labels with a value of null from the topology string

Avoid the OSD startup failing to parse crush_location when
the topology label is empty.

Signed-off-by: chentao.2022 <chentao.2022@bytedance.com>
(cherry picked from commit 62631d2614)
This commit is contained in:
chentao.2022 authored and Mergify committed 2025-07-30 22:41:33 +00:00
1 parent b1c6a59f3b
commit 4f2c92a6c8
1 file changed
+1 -1
@@ -102,7 +102,7 @@ func extractTopologyFromLabels(labels map[string]string) (map[string]string, str
// for the topology affinity
for _, label := range allKubernetesTopologyLabels {
topologyID := kubernetesTopologyLabelToCRUSHLabel(label)
if value, ok := labels[label]; ok {
if value, ok := labels[label]; ok && value != "" {
topology[topologyID] = value
if topologyID != "host" {
topologyAffinity = formatTopologyAffinity(label, value)