summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/volumes.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-02-11 12:47:47 -0600
committerbaude <bbaude@redhat.com>2019-02-13 12:43:51 -0600
commit4f60f79a27012220afdbcf8f2f4bb4622ca8c176 (patch)
tree5a0a43a03a17ad51678695a9d65270725b0b7893 /pkg/varlinkapi/volumes.go
parent8a16f83b0a13ab9de1cc905a3ff1132c75739995 (diff)
downloadpodman-4f60f79a27012220afdbcf8f2f4bb4622ca8c176.tar.gz
podman-4f60f79a27012220afdbcf8f2f4bb4622ca8c176.tar.bz2
podman-4f60f79a27012220afdbcf8f2f4bb4622ca8c176.zip
podman-remote volume inspect|ls
add the ability to list and inspect volumes using the remote client and varlink Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/varlinkapi/volumes.go')
-rw-r--r--pkg/varlinkapi/volumes.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/pkg/varlinkapi/volumes.go b/pkg/varlinkapi/volumes.go
index ced394e90..d41b07065 100644
--- a/pkg/varlinkapi/volumes.go
+++ b/pkg/varlinkapi/volumes.go
@@ -36,3 +36,39 @@ func (i *LibpodAPI) VolumeRemove(call iopodman.VarlinkCall, options iopodman.Vol
}
return call.ReplyVolumeRemove(deletedVolumes)
}
+
+// GetVolumes returns all the volumes known to the remote system
+func (i *LibpodAPI) GetVolumes(call iopodman.VarlinkCall, args []string, all bool) error {
+ var (
+ err error
+ reply []*libpod.Volume
+ volumes []iopodman.Volume
+ )
+ if all {
+ reply, err = i.Runtime.GetAllVolumes()
+ } else {
+ for _, v := range args {
+ vol, err := i.Runtime.GetVolume(v)
+ if err != nil {
+ return err
+ }
+ reply = append(reply, vol)
+ }
+ }
+ if err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+ // Build the iopodman.volume struct for the return
+ for _, v := range reply {
+ newVol := iopodman.Volume{
+ Driver: v.Driver(),
+ Labels: v.Labels(),
+ MountPoint: v.MountPoint(),
+ Name: v.Name(),
+ Options: v.Options(),
+ Scope: v.Scope(),
+ }
+ volumes = append(volumes, newVol)
+ }
+ return call.ReplyGetVolumes(volumes)
+}