...

Package helper

import "github.com/chaos-mesh/chaos-mesh/pkg/chaosdaemon/helper"
Overview
Index

Overview ▾

Index ▾

Package files

blockchaos.go

Variables

var NormalizeVolumeNameCmd = &cobra.Command{
    Use:   "normalize-volume-name [path]",
    Short: "get the device name from the path",
    Long: `Get the device name from the path.
The path could be a directory, a partition, or a block device.
The block device name will be printed out.`,
    Run: func(cmd *cobra.Command, args []string) {
        if len(args) != 1 {
            cmd.Help()
            os.Exit(1)
        }

        volumePath := args[0]
        deviceName, err := normalizeVolumeName(volumePath)
        if err != nil {
            fmt.Fprintln(os.Stderr, err)
            os.Exit(1)
        }

        fmt.Println(deviceName)
    },
}