aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/volumes/unmount.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-03-01 03:53:21 -0500
committerGitHub <noreply@github.com>2022-03-01 03:53:21 -0500
commit87d22e101465fa9e8d25653918328e768a92aa71 (patch)
treeda115e8d159200a765c5eff9f3abfa56f3e49094 /cmd/podman/volumes/unmount.go
parent86a057e6be434159e3e60add5a7a7d649e0b4ad5 (diff)
parent3dc1b8e83f2459a58d65f3bb918975cd6f1bb794 (diff)
downloadpodman-87d22e101465fa9e8d25653918328e768a92aa71.tar.gz
podman-87d22e101465fa9e8d25653918328e768a92aa71.tar.bz2
podman-87d22e101465fa9e8d25653918328e768a92aa71.zip
Merge pull request #13318 from rhatdan/volume
Add podman volume mount support
Diffstat (limited to 'cmd/podman/volumes/unmount.go')
-rw-r--r--cmd/podman/volumes/unmount.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/cmd/podman/volumes/unmount.go b/cmd/podman/volumes/unmount.go
new file mode 100644
index 000000000..dd0cebc06
--- /dev/null
+++ b/cmd/podman/volumes/unmount.go
@@ -0,0 +1,48 @@
+package volumes
+
+import (
+ "fmt"
+
+ "github.com/containers/podman/v4/cmd/podman/common"
+ "github.com/containers/podman/v4/cmd/podman/registry"
+ "github.com/containers/podman/v4/cmd/podman/utils"
+ "github.com/spf13/cobra"
+)
+
+var (
+ volumeUnmountDescription = `Unmount a volume`
+ volumeUnmountCommand = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
+ Use: "unmount NAME",
+ Short: "Unmount volume",
+ Long: volumeUnmountDescription,
+ RunE: volumeUnmount,
+ Example: `podman volume unmount myvol`,
+ Args: cobra.ExactArgs(1),
+ ValidArgsFunction: common.AutocompleteVolumes,
+ }
+)
+
+func init() {
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Command: volumeUnmountCommand,
+ Parent: volumeCmd,
+ })
+}
+
+func volumeUnmount(cmd *cobra.Command, args []string) error {
+ var errs utils.OutputErrors
+ reports, err := registry.ContainerEngine().VolumeUnmount(registry.GetContext(), args)
+ if err != nil {
+ return err
+ }
+ for _, r := range reports {
+ var errs utils.OutputErrors
+ if r.Err == nil {
+ fmt.Println(r.Id)
+ } else {
+ errs = append(errs, r.Err)
+ }
+ }
+ return errs.PrintErrors()
+}