Skip to content

Commit

Permalink
cephcluster: tune disks according to plaftorm
Browse files Browse the repository at this point in the history
set tunefastdeviceclass according to plaftorm
which are not correctly detected by ceph.
modify tc according to the changes.

Signed-off-by: crombus <pkundra@redhat.com>
  • Loading branch information
crombus committed Jan 15, 2021
1 parent bc3d8b5 commit 45dbe6f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
8 changes: 8 additions & 0 deletions controllers/storagecluster/cephcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,14 @@ func (r *StorageClusterReconciler) checkTuneStorageDevices(ds ocsv1.StorageDevic
return dt.speed, nil
}

tuneFastDevices, err := r.DevicesDefaultToFastForThisPlatform()
if err != nil {
return diskSpeedUnknown, err
}
if tuneFastDevices {
return diskSpeedFast, nil
}

// not a known disk type, don't tune
return diskSpeedUnknown, nil
}
Expand Down
23 changes: 23 additions & 0 deletions controllers/storagecluster/platform_detection.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ var AvoidObjectStorePlatforms = []configv1.PlatformType{
configv1.AzurePlatformType,
}

// TuneFastPlatforms is a list of all PlatformTypes where TuneFastDeviceClass has to be set True.
var TuneFastPlatforms = []configv1.PlatformType{
configv1.OvirtPlatformType,
configv1.IBMCloudPlatformType,
configv1.AzurePlatformType,
}

// Platform is used to get the CloudPlatformType of the running cluster in a thread-safe manner
type Platform struct {
platform configv1.PlatformType
Expand Down Expand Up @@ -55,3 +62,19 @@ func avoidObjectStore(p configv1.PlatformType) bool {
}
return false
}

func (r *ReconcileStorageCluster) DevicesDefaultToFastForThisPlatform() (bool, error) {
c := r.client
platform, err := r.platform.GetPlatform(c)
if err != nil {
return false, err
}

for _, tfplatform := range TuneFastPlatforms {
if platform == tfplatform {
return true, nil
}
}

return false, nil
}
5 changes: 3 additions & 2 deletions controllers/storagecluster/storagecluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,12 @@ func TestThrottleStorageDevices(t *testing.T) {
StorageClassName: &fakestorageClassName,
},
},
Portable: true,
Portable: true,
DeviceType: "hdd",
},
},
storageCluster: &api.StorageCluster{},
expectedSpeed: diskSpeedUnknown,
expectedSpeed: diskSpeedSlow,
},
{
label: "Case 3", // storageclass is managed-premium
Expand Down

0 comments on commit 45dbe6f

Please sign in to comment.