From faf5eba8dcbceff6ef816ca3dd03192ba4ac176b Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Wed, 26 Oct 2022 16:50:04 -0600 Subject: [PATCH] osd: reduce duplication of arguments The osd arguments had a few duplicate lines that could be factored out and thus simplified for code maintainability. Signed-off-by: Travis Nielsen --- pkg/operator/ceph/cluster/osd/spec.go | 34 ++++++++------------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/pkg/operator/ceph/cluster/osd/spec.go b/pkg/operator/ceph/cluster/osd/spec.go index 9ad09048b..9185d3557 100644 --- a/pkg/operator/ceph/cluster/osd/spec.go +++ b/pkg/operator/ceph/cluster/osd/spec.go @@ -367,42 +367,28 @@ func (c *Cluster) makeDeployment(osdProps osdProperties, osd OSDInfo, provisionC args = []string{ "ceph", "osd", "start", "--", - "--foreground", - "--id", osdID, - "--fsid", c.clusterInfo.FSID, - "--cluster", "ceph", - "--setuser", "ceph", - "--setgroup", "ceph", - fmt.Sprintf("--crush-location=%s", osd.Location), } osd.LVBackedPV = true } else { - // raw mode + // raw mode on pvc doBinaryCopyInit = false doConfigInit = false command = []string{"ceph-osd"} - args = []string{ - "--foreground", - "--id", osdID, - "--fsid", c.clusterInfo.FSID, - "--setuser", "ceph", - "--setgroup", "ceph", - fmt.Sprintf("--crush-location=%s", osd.Location), - } } } else { + // non-pvc doBinaryCopyInit = false doConfigInit = false command = []string{"ceph-osd"} - args = []string{ - "--foreground", - "--id", osdID, - "--fsid", c.clusterInfo.FSID, - "--setuser", "ceph", - "--setgroup", "ceph", - fmt.Sprintf("--crush-location=%s", osd.Location), - } } + args = append(args, []string{ + "--foreground", + "--id", osdID, + "--fsid", c.clusterInfo.FSID, + "--setuser", "ceph", + "--setgroup", "ceph", + fmt.Sprintf("--crush-location=%s", osd.Location), + }...) // Ceph expects initial weight as float value in tera-bytes units if osdProps.storeConfig.InitialWeight != "" {