summaryrefslogtreecommitdiff
path: root/cmd/podman/volume_create.go
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-04-16 12:25:26 -0500
committerBrent Baude <bbaude@redhat.com>2020-04-16 15:53:58 -0500
commit241326a9a8c20ad7f2bcf651416b836e7778e090 (patch)
tree4001e8e47a022bb1b9bfbf2332c42e1aeb802f9e /cmd/podman/volume_create.go
parent88c6fd06cd54fb9a8826306dfdf1a77e400de5de (diff)
downloadpodman-241326a9a8c20ad7f2bcf651416b836e7778e090.tar.gz
podman-241326a9a8c20ad7f2bcf651416b836e7778e090.tar.bz2
podman-241326a9a8c20ad7f2bcf651416b836e7778e090.zip
Podman V2 birth
remote podman v1 and replace with podman v2. Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/volume_create.go')
-rw-r--r--cmd/podman/volume_create.go69
1 files changed, 0 insertions, 69 deletions
diff --git a/cmd/podman/volume_create.go b/cmd/podman/volume_create.go
deleted file mode 100644
index 52189657b..000000000
--- a/cmd/podman/volume_create.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package main
-
-import (
- "fmt"
-
- "github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/cmd/podman/shared/parse"
- "github.com/containers/libpod/pkg/adapter"
- "github.com/pkg/errors"
- "github.com/spf13/cobra"
-)
-
-var (
- volumeCreateCommand cliconfig.VolumeCreateValues
- volumeCreateDescription = `If using the default driver, "local", the volume will be created on the host in the volumes directory under container storage.`
-
- _volumeCreateCommand = &cobra.Command{
- Use: "create [flags] [NAME]",
- Short: "Create a new volume",
- Long: volumeCreateDescription,
- RunE: func(cmd *cobra.Command, args []string) error {
- volumeCreateCommand.InputArgs = args
- volumeCreateCommand.GlobalFlags = MainGlobalOpts
- volumeCreateCommand.Remote = remoteclient
- return volumeCreateCmd(&volumeCreateCommand)
- },
- Example: `podman volume create myvol
- podman volume create
- podman volume create --label foo=bar myvol`,
- }
-)
-
-func init() {
- volumeCreateCommand.Command = _volumeCreateCommand
- volumeCommand.SetHelpTemplate(HelpTemplate())
- volumeCreateCommand.SetUsageTemplate(UsageTemplate())
- flags := volumeCreateCommand.Flags()
- flags.StringVar(&volumeCreateCommand.Driver, "driver", "", "Specify volume driver name (default local)")
- flags.StringSliceVarP(&volumeCreateCommand.Label, "label", "l", []string{}, "Set metadata for a volume (default [])")
- flags.StringArrayVarP(&volumeCreateCommand.Opt, "opt", "o", []string{}, "Set driver specific options (default [])")
-}
-
-func volumeCreateCmd(c *cliconfig.VolumeCreateValues) error {
- runtime, err := adapter.GetRuntime(getContext(), &c.PodmanCommand)
- if err != nil {
- return errors.Wrapf(err, "error creating libpod runtime")
- }
- defer runtime.DeferredShutdown(false)
-
- if len(c.InputArgs) > 1 {
- return errors.Errorf("too many arguments, create takes at most 1 argument")
- }
-
- labels, err := parse.GetAllLabels([]string{}, c.Label)
- if err != nil {
- return errors.Wrapf(err, "unable to process labels")
- }
-
- opts, err := parse.GetAllLabels([]string{}, c.Opt)
- if err != nil {
- return errors.Wrapf(err, "unable to process options")
- }
-
- volumeName, err := runtime.CreateVolume(getContext(), c, labels, opts)
- if err == nil {
- fmt.Println(volumeName)
- }
- return err
-}