From 5c6bf8978db43d5d02f39facfa1ca7b7d83304af Mon Sep 17 00:00:00 2001 From: parth-gr Date: Thu, 25 Nov 2021 20:27:58 +0530 Subject: [PATCH] osd: update existing OSDs with deviceClass If we apply useAllNodes to false for the current deployment, the OSDs should get updated with the individual nodes values and config, The deviceClass was not updating to the existing OSDs because there was bug in the check. The check osdInfo.DeviceClass == "" which should be checked like this osdInfo.DeviceClass == "None" Updated the code so OSDs can make use of the devices present Signed-off-by: parth-gr --- pkg/daemon/ceph/client/osd.go | 2 +- pkg/operator/ceph/cluster/osd/osd.go | 2 +- pkg/operator/ceph/cluster/osd/update.go | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/daemon/ceph/client/osd.go b/pkg/daemon/ceph/client/osd.go index 4df569b07202f..f0870918343dc 100644 --- a/pkg/daemon/ceph/client/osd.go +++ b/pkg/daemon/ceph/client/osd.go @@ -310,7 +310,7 @@ func OsdListNum(context *clusterd.Context, clusterInfo *ClusterInfo) (OsdList, e // OSDDeviceClass report device class for osd type OSDDeviceClass struct { ID int `json:"osd"` - DeviceClass string `json:"device_class"` + DeviceClass string `json:"device_class,omitempty"` } // OSDDeviceClasses returns the device classes for particular OsdIDs diff --git a/pkg/operator/ceph/cluster/osd/osd.go b/pkg/operator/ceph/cluster/osd/osd.go index b9a9a008011d8..e692bbd9dccaa 100644 --- a/pkg/operator/ceph/cluster/osd/osd.go +++ b/pkg/operator/ceph/cluster/osd/osd.go @@ -96,7 +96,7 @@ type OSDInfo struct { Cluster string `json:"cluster"` UUID string `json:"uuid"` DevicePartUUID string `json:"device-part-uuid"` - DeviceClass string `json:"device-class"` + DeviceClass string `json:"device-class,omitempty"` // BlockPath is the logical Volume path for an OSD created by Ceph-volume with format '/dev//' or simply /dev/vdb if block mode is used BlockPath string `json:"lv-path"` MetadataPath string `json:"metadata-path"` diff --git a/pkg/operator/ceph/cluster/osd/update.go b/pkg/operator/ceph/cluster/osd/update.go index 0790aed356040..d0b33619bfc7e 100644 --- a/pkg/operator/ceph/cluster/osd/update.go +++ b/pkg/operator/ceph/cluster/osd/update.go @@ -126,7 +126,8 @@ func (c *updateConfig) updateExistingOSDs(errs *provisionErrors) { } // backward compatibility for old deployments - if osdInfo.DeviceClass == "" { + // Checking DeviceClass with None too, because ceph architecture return crush device class as None + if osdInfo.DeviceClass == "" || osdInfo.DeviceClass == "None" { deviceClassInfo, err := cephclient.OSDDeviceClasses(c.cluster.context, c.cluster.clusterInfo, []string{strconv.Itoa(osdID)}) if err != nil { logger.Errorf("failed to get device class for existing deployment %q. %v", depName, err)