Skip to content

Commit

Permalink
expose option to force remove the OSD in osd removal template
Browse files Browse the repository at this point in the history
adding option to expose `--force-osd-removal` `<true/false>`.
It will help when Ceph indicates the OSD is not safe-to-destroy.

Signed-off-by: subhamkrai <srai@redhat.com>
  • Loading branch information
subhamkrai authored and openshift-cherrypick-robot committed Feb 15, 2022
1 parent 1f1ad2e commit 9b2e495
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions controllers/storagecluster/job_templates.go
Expand Up @@ -34,6 +34,8 @@ var osdCleanupArgs = []string{
"osd",
"remove",
"--osd-ids=${FAILED_OSD_IDS}",
"--force-osd-removal",
"${FORCE_OSD_REMOVAL}",
}

// ensureCreated ensures if the osd removal job template exists
Expand Down Expand Up @@ -85,6 +87,17 @@ In the event of errors or invalid user inputs,
the Job will attempt to remove as many OSDs as can be processed and complete without returning an error condition.
Users should always check for errors and success in the log of the finished OSD removal Job.`,
},
{
Name: "FORCE_OSD_REMOVAL",
DisplayName: "Force OSD Removal",
Required: false,
Value: "false",
Description: `
A flag indicating whether the OSD should be forcefully removed. Valid values are true or false.
The default value is false. If an OSD is being removed that could lead to data loss, the OSD
will not be removed by default. If you see the osd removal fails and you are sure the OSD
should be removed, set this flag to true and run the job again.`,
},
},
Objects: []runtime.RawExtension{
{
Expand Down
2 changes: 1 addition & 1 deletion controllers/storagecluster/job_templates_test.go
Expand Up @@ -23,7 +23,7 @@ func TestJobTemplates(t *testing.T) {
}{
{
jobTemplateName: "ocs-osd-removal",
templateParameters: []string{"FAILED_OSD_IDS"},
templateParameters: []string{"FAILED_OSD_IDS", "FORCE_OSD_REMOVAL"},
jobCmds: osdCleanupArgs,
jobFunc: newosdCleanUpJob,
},
Expand Down

0 comments on commit 9b2e495

Please sign in to comment.