diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-02-13 20:20:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-13 20:20:10 +0100 |
commit | fa3b91dc1216e6057e24a574bec566401800d780 (patch) | |
tree | 5a0a43a03a17ad51678695a9d65270725b0b7893 /pkg/varlinkapi | |
parent | 8a16f83b0a13ab9de1cc905a3ff1132c75739995 (diff) | |
parent | 4f60f79a27012220afdbcf8f2f4bb4622ca8c176 (diff) | |
download | podman-fa3b91dc1216e6057e24a574bec566401800d780.tar.gz podman-fa3b91dc1216e6057e24a574bec566401800d780.tar.bz2 podman-fa3b91dc1216e6057e24a574bec566401800d780.zip |
Merge pull request #2316 from baude/remotevolumeinspect
podman-remote volume inspect|ls
Diffstat (limited to 'pkg/varlinkapi')
-rw-r--r-- | pkg/varlinkapi/volumes.go | 36 |
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) +} |