Skip to content

Commit

Permalink
osd: update existing OSDs with deviceClass
Browse files Browse the repository at this point in the history
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 <paarora@redhat.com>
  • Loading branch information
parth-gr committed Nov 29, 2021
1 parent 35b28f7 commit 5c6bf89
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/daemon/ceph/client/osd.go
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/ceph/cluster/osd/osd.go
Expand Up @@ -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/<Volume Group>/<Logical Volume>' or simply /dev/vdb if block mode is used
BlockPath string `json:"lv-path"`
MetadataPath string `json:"metadata-path"`
Expand Down
3 changes: 2 additions & 1 deletion pkg/operator/ceph/cluster/osd/update.go
Expand Up @@ -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)
Expand Down

0 comments on commit 5c6bf89

Please sign in to comment.