aboutsummaryrefslogtreecommitdiff
path: root/test/testvol/create.go
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-06-27 17:55:19 +0000
committerGitHub <noreply@github.com>2022-06-27 17:55:19 +0000
commit9c4b8a29b06c179725983e7fa8fadf7ee68d9863 (patch)
treecd2aa0d35a9479aa8f4afc0f17b941b5fb9c5882 /test/testvol/create.go
parent278afae1de55a2951b2a4810b100d14e5647977b (diff)
parent2fab7d169b0714574b6620f454c1408bf8097d4f (diff)
downloadpodman-9c4b8a29b06c179725983e7fa8fadf7ee68d9863.tar.gz
podman-9c4b8a29b06c179725983e7fa8fadf7ee68d9863.tar.bz2
podman-9c4b8a29b06c179725983e7fa8fadf7ee68d9863.zip
Merge pull request #14713 from Luap99/volume-plugin
add podman volume reload to sync volume plugins
Diffstat (limited to 'test/testvol/create.go')
-rw-r--r--test/testvol/create.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/testvol/create.go b/test/testvol/create.go
new file mode 100644
index 000000000..d29300f0b
--- /dev/null
+++ b/test/testvol/create.go
@@ -0,0 +1,26 @@
+package main
+
+import (
+ pluginapi "github.com/docker/go-plugins-helpers/volume"
+ "github.com/spf13/cobra"
+)
+
+var createCmd = &cobra.Command{
+ Use: "create NAME",
+ Short: "create a volume",
+ Long: `Create a volume in the volume plugin listening on --sock-name`,
+ Args: cobra.ExactArgs(1),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ return createVol(config.sockName, args[0])
+ },
+}
+
+func createVol(sockName, volName string) error {
+ plugin, err := getPlugin(sockName)
+ if err != nil {
+ return err
+ }
+ createReq := new(pluginapi.CreateRequest)
+ createReq.Name = volName
+ return plugin.CreateVolume(createReq)
+}