Skip to content

Commit

Permalink
Added the ability to pause provisioning of volume on storage backend …
Browse files Browse the repository at this point in the history
…based on user requests.
  • Loading branch information
shashank-netapp authored Aug 14, 2023
1 parent 7270530 commit 9a541c4
Show file tree
Hide file tree
Showing 44 changed files with 1,180 additions and 164 deletions.
5 changes: 3 additions & 2 deletions cli/cmd/create_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ var createBackendCmd = &cobra.Command{

if OperatingMode == ModeTunnel {
command := []string{"create", "backend", "--base64", base64.StdEncoding.EncodeToString(jsonData)}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
return backendCreate(jsonData)
}
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/delete_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ var deleteBackendCmd = &cobra.Command{
if allBackends {
command = append(command, "--all")
}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
return backendDelete(args)
}
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/delete_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ var deleteNodeCmd = &cobra.Command{
if allVolumes {
command = append(command, "--all")
}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
return nodeDelete(args)
}
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/delete_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ var deleteSnapshotCmd = &cobra.Command{
if allSnapshots {
command = append(command, "--all")
}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
return snapshotDelete(args)
}
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/delete_storageclass.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ var deleteStorageClassCmd = &cobra.Command{
if allStorageClasses {
command = append(command, "--all")
}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
return storageClassDelete(args)
}
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/delete_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ var deleteVolumeCmd = &cobra.Command{
if allVolumes {
command = append(command, "--all")
}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
return volumeDelete(args)
}
Expand Down
8 changes: 5 additions & 3 deletions cli/cmd/get_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ var getBackendCmd = &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
if OperatingMode == ModeTunnel {
command := []string{"get", "backend"}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
return backendList(args)
}
Expand Down Expand Up @@ -196,7 +197,7 @@ func getSolidfireStorageDriverConfig(configAsMap map[string]interface{}) (*drive

func writeBackendTable(backends []storage.BackendExternal) {
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Name", "Storage Driver", "UUID", "State", "Volumes"})
table.SetHeader([]string{"Name", "Storage Driver", "UUID", "State", "User-State", "Volumes"})

for _, b := range backends {
if b.Config == nil {
Expand All @@ -210,6 +211,7 @@ func writeBackendTable(backends []storage.BackendExternal) {
storageDriverName,
b.BackendUUID,
b.State.String(),
b.UserState.String(),
strconv.Itoa(len(b.Volumes)),
})
}
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/get_logconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ var getLogConfigCmd = &cobra.Command{
if getAllLayers {
command = append(command, "--get-available-log-layers")
}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
return getLogConfig()
}
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/get_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ var getNodeCmd = &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
if OperatingMode == ModeTunnel {
command := []string{"get", "node"}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
return nodeList(args)
}
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/get_publication.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ var getPublicationCmd = &cobra.Command{
command = append(command, "--node", getNode)
}

TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
if getVolume != "" && getNode != "" {
return volumePublicationGet()
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/get_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ var getSnapshotCmd = &cobra.Command{
if getSnapshotVolume != "" {
command = append(command, "--volume", getSnapshotVolume)
}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
return snapshotList(args)
}
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/get_storageclass.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ var getStorageClassCmd = &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
if OperatingMode == ModeTunnel {
command := []string{"get", "storageclass"}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
return storageClassList(args)
}
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/get_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ var getVolumeCmd = &cobra.Command{
if getSubordinateVolume != "" {
command = append(command, "--parentOfSubordinate", getSubordinateVolume)
}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
return volumeList(args)
}
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ var getImageCmd = &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
if OperatingMode == ModeTunnel {
command := []string{"images"}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {

if err := InitLogLevel("warn"); err != nil {
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/import_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ Volume path').`,
if importNoManage {
command = append(command, "--no-manage")
}
TunnelCommand(append(command, args...))
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
return volumeImport(args[0], args[1], importNoManage, pvcDataJSON)
}
Expand Down
14 changes: 7 additions & 7 deletions cli/cmd/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func getTridentLogs(logName string) error {
}

// Get logs
logBytes, err := execKubernetesCLI(logsCommand...).CombinedOutput()
logBytes, err := execKubernetesCLI(logsCommand...)
if err != nil {
logErrors = appendError(logErrors, logBytes)
} else {
Expand All @@ -292,7 +292,7 @@ func getTridentLogs(logName string) error {
}

// Get logs
logBytes, err = execKubernetesCLI(logsCommand...).CombinedOutput()
logBytes, err = execKubernetesCLI(logsCommand...)
if err != nil {
logErrors = appendError(logErrors, logBytes)
} else {
Expand Down Expand Up @@ -337,7 +337,7 @@ func getNodeLogs(logName, nodeName string) error {
}

// Get logs
logBytes, err := execKubernetesCLI(logsCommand...).CombinedOutput()
logBytes, err := execKubernetesCLI(logsCommand...)
if err != nil {
logErrors = appendError(logErrors, logBytes)
} else {
Expand All @@ -360,7 +360,7 @@ func getNodeLogs(logName, nodeName string) error {
}

// Get logs
logBytes, err = execKubernetesCLI(logsCommand...).CombinedOutput()
logBytes, err = execKubernetesCLI(logsCommand...)
if err != nil {
logErrors = appendError(logErrors, logBytes)
} else {
Expand Down Expand Up @@ -406,7 +406,7 @@ func getAllNodeLogs(logName string) error {
}

// Get logs
logBytes, err := execKubernetesCLI(logsCommand...).CombinedOutput()
logBytes, err := execKubernetesCLI(logsCommand...)
if err != nil {
logErrors = appendError(logErrors, logBytes)
} else {
Expand All @@ -429,7 +429,7 @@ func getAllNodeLogs(logName string) error {
}

// Get logs
logBytes, err = execKubernetesCLI(logsCommand...).CombinedOutput()
logBytes, err = execKubernetesCLI(logsCommand...)
if err != nil {
logErrors = appendError(logErrors, logBytes)
} else {
Expand Down Expand Up @@ -465,7 +465,7 @@ func getTridentOperatorLogs(logName string) error {
}

// Get logs
logBytes, err := execKubernetesCLI(logsCommand...).CombinedOutput()
logBytes, err := execKubernetesCLI(logsCommand...)
if err != nil {
logErrors = appendError(logErrors, logBytes)
} else {
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/obliviate_crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ var obliviateCRDCmd = &cobra.Command{
}
}
command := []string{"obliviate", "crd", fmt.Sprintf("--%s", forceConfirmation)}
TunnelCommand(command)
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
if err := initClients(); err != nil {
return err
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/obliviate_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ var obliviateSecretCmd = &cobra.Command{
}
}
command := []string{"obliviate", "secret", fmt.Sprintf("--%s", forceConfirmation)}
TunnelCommand(command)
return nil
out, err := TunnelCommand(append(command, args...))
printOutput(cmd, out, err)
return err
} else {
if err := initClients(); err != nil {
return err
Expand Down
Loading

0 comments on commit 9a541c4

Please sign in to comment.