Files
podman/pkg/varlinkapi/mount.go
baude ba65301c95 podman-remote create|run
add the ability to create and run containers via the podman-remote
client.

we now create an intermediate layer from the the create/run cli flags.
the intermediate layer can be converted into a createconfig or into a
varlink struct.  Once transported, the varlink struct can be converted
back to an intermediate layer and then to a createconfig.

remote terminals are not supported yet.

Signed-off-by: baude <bbaude@redhat.com>
2019-04-08 09:05:31 -05:00

52 lines
1.3 KiB
Go

// +build varlink
package varlinkapi
import (
"github.com/containers/libpod/cmd/podman/varlink"
)
// ListContainerMounts ...
func (i *LibpodAPI) ListContainerMounts(call iopodman.VarlinkCall) error {
mounts := make(map[string]string)
allContainers, err := i.Runtime.GetAllContainers()
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
for _, container := range allContainers {
mounted, mountPoint, err := container.Mounted()
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
if mounted {
mounts[container.ID()] = mountPoint
}
}
return call.ReplyListContainerMounts(mounts)
}
// MountContainer ...
func (i *LibpodAPI) MountContainer(call iopodman.VarlinkCall, name string) error {
container, err := i.Runtime.LookupContainer(name)
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
path, err := container.Mount()
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
return call.ReplyMountContainer(path)
}
// UnmountContainer ...
func (i *LibpodAPI) UnmountContainer(call iopodman.VarlinkCall, name string, force bool) error {
container, err := i.Runtime.LookupContainer(name)
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
if err := container.Unmount(force); err != nil {
return call.ReplyErrorOccurred(err.Error())
}
return call.ReplyUnmountContainer()
}