From 4f60f79a27012220afdbcf8f2f4bb4622ca8c176 Mon Sep 17 00:00:00 2001 From: baude Date: Mon, 11 Feb 2019 12:47:47 -0600 Subject: podman-remote volume inspect|ls add the ability to list and inspect volumes using the remote client and varlink Signed-off-by: baude --- pkg/varlinkapi/volumes.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'pkg') 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) +} -- cgit v1.2.3-54-g00ecf