From e5f7f0aa3c74a46f9dea0dbf6af4e15810560707 Mon Sep 17 00:00:00 2001 From: Umanga Chapagain Date: Tue, 5 Dec 2023 13:45:58 +0530 Subject: [PATCH] refactor getOsdCount() to make it reusable Signed-off-by: Umanga Chapagain --- controllers/storagecluster/cephcluster.go | 4 ++-- controllers/storagecluster/resourceprofile.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/storagecluster/cephcluster.go b/controllers/storagecluster/cephcluster.go index 0da359b8fe..6f09da6091 100644 --- a/controllers/storagecluster/cephcluster.go +++ b/controllers/storagecluster/cephcluster.go @@ -1308,8 +1308,8 @@ func isBluestore(store rookCephv1.OSDStore) bool { return false } -func (r *StorageClusterReconciler) getOsdCount(sc *ocsv1.StorageCluster) int { - storageClassDeviceSets := newStorageClassDeviceSets(sc, r.serverVersion) +func getOsdCount(sc *ocsv1.StorageCluster, serverVersion *version.Info) int { + storageClassDeviceSets := newStorageClassDeviceSets(sc, serverVersion) osdCount := 0 for _, ds := range storageClassDeviceSets { osdCount += ds.Count diff --git a/controllers/storagecluster/resourceprofile.go b/controllers/storagecluster/resourceprofile.go index b19b862b7e..359a22af44 100644 --- a/controllers/storagecluster/resourceprofile.go +++ b/controllers/storagecluster/resourceprofile.go @@ -51,7 +51,7 @@ func (r *StorageClusterReconciler) ensureResourceProfileChangeApplied(sc *ocsv1. } // Verify if expected number of osd pods with the current resource profile label are running - if err := r.verifyDaemonWithResourceProfile(sc.Namespace, map[string]string{"app": "rook-ceph-osd", defaults.ODFResourceProfileKey: currentResourceProfile}, r.getOsdCount(sc)); err != nil { + if err := r.verifyDaemonWithResourceProfile(sc.Namespace, map[string]string{"app": "rook-ceph-osd", defaults.ODFResourceProfileKey: currentResourceProfile}, getOsdCount(sc, r.serverVersion)); err != nil { return err }