purgeosd

package
v0.0.0-...-cc62d39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CephPurgeOsdCmd = &cobra.Command{
	Use:     "purge-osd",
	Short:   "Permanently remove an OSD from the cluster.",
	Args:    cobra.ExactArgs(1),
	Example: "odf purge-osd <ID>",
	PreRunE: validateOsdID,
	Run: func(cmd *cobra.Command, args []string) {
		ctx := cmd.Context()
		forceflagValue := "false"
		osdID := args[0]

		safeToDestroy, err := osd.SafeToDestroy(ctx, root.ClientSets, root.OperatorNamespace, root.StorageClusterNamespace, osdID)
		if !safeToDestroy {
			var answer string
			yesForceDestroyOSD := "yes-force-destroy-osd"
			logging.Warning("Are you sure you want to purge osd.%s? The OSD is *not* safe to destroy. This may lead to data loss. If you are sure the OSD should be purged, enter '%s'", osdID, yesForceDestroyOSD)
			fmt.Scanf("%s", &answer)

			err := mons.PromptToContinueOrCancel(yesForceDestroyOSD, answer)
			if err != nil {
				logging.Fatal(err)
			}

			forceflagValue = "true"
		} else if err != nil {
			logging.Fatal(errors.Wrapf(err, "failed to check if osd.%s is safe to destroy", osdID))
		}

		rook.PurgeOsd(ctx, root.ClientSets, root.OperatorNamespace, root.StorageClusterNamespace, osdID, forceflagValue)
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL