summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-12 02:54:34 +0100
committerGitHub <noreply@github.com>2019-02-12 02:54:34 +0100
commitea20ead35b69b1259f2ff3b00f558c473a921b95 (patch)
tree9a7e3faba300608db3dd2ee24fbaf02ebf9e66a3 /pkg
parent54a5584d84d37632c1c8480d437a012625526a84 (diff)
parent358da6c8c0375ad41c4669aeef71f9626710c83e (diff)
downloadpodman-ea20ead35b69b1259f2ff3b00f558c473a921b95.tar.gz
podman-ea20ead35b69b1259f2ff3b00f558c473a921b95.tar.bz2
podman-ea20ead35b69b1259f2ff3b00f558c473a921b95.zip
Merge pull request #2313 from baude/remotevolumecreate
podman-remote volume create
Diffstat (limited to 'pkg')
-rw-r--r--pkg/varlinkapi/volumes.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/pkg/varlinkapi/volumes.go b/pkg/varlinkapi/volumes.go
new file mode 100644
index 000000000..d1e4ae3c6
--- /dev/null
+++ b/pkg/varlinkapi/volumes.go
@@ -0,0 +1,29 @@
+package varlinkapi
+
+import (
+ "github.com/containers/libpod/cmd/podman/varlink"
+ "github.com/containers/libpod/libpod"
+)
+
+// VolumeCreate creates a libpod volume based on input from a varlink connection
+func (i *LibpodAPI) VolumeCreate(call iopodman.VarlinkCall, options iopodman.VolumeCreateOpts) error {
+ var volumeOptions []libpod.VolumeCreateOption
+
+ if len(options.VolumeName) > 0 {
+ volumeOptions = append(volumeOptions, libpod.WithVolumeName(options.VolumeName))
+ }
+ if len(options.Driver) > 0 {
+ volumeOptions = append(volumeOptions, libpod.WithVolumeDriver(options.Driver))
+ }
+ if len(options.Labels) > 0 {
+ volumeOptions = append(volumeOptions, libpod.WithVolumeLabels(options.Labels))
+ }
+ if len(options.Options) > 0 {
+ volumeOptions = append(volumeOptions, libpod.WithVolumeOptions(options.Options))
+ }
+ newVolume, err := i.Runtime.NewVolume(getContext(), volumeOptions...)
+ if err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+ return call.ReplyVolumeCreate(newVolume.Name())
+}