moby/volume/drivers/proxy.go
Tibor Vass 3a571b72fd plugins: container-rootfs-relative paths
Legacy plugins expect host-relative paths (such as for Volume.Mount).
However, a containerized plugin cannot respond with a host-relative
path. Therefore, this commit modifies new volume plugins' paths in Mount
and List to prepend the container's rootfs path.

This introduces a new PropagatedMount field in the Plugin Config.
When it is set for volume plugins, RootfsPropagation is set to rshared
and the path specified by PropagatedMount is bind-mounted with rshared
prior to launching the container. This is so that the daemon code can
access the paths returned by the plugin from the host mount namespace.

Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit c54b717caf)
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-12-09 14:16:04 -08:00

242 lines
4 KiB
Go

// generated code - DO NOT EDIT
package volumedrivers
import (
"errors"
"github.com/docker/docker/volume"
)
type client interface {
Call(string, interface{}, interface{}) error
}
type volumeDriverProxy struct {
client
}
type volumeDriverProxyCreateRequest struct {
Name string
Opts map[string]string
}
type volumeDriverProxyCreateResponse struct {
Err string
}
func (pp *volumeDriverProxy) Create(name string, opts map[string]string) (err error) {
var (
req volumeDriverProxyCreateRequest
ret volumeDriverProxyCreateResponse
)
req.Name = name
req.Opts = opts
if err = pp.Call("VolumeDriver.Create", req, &ret); err != nil {
return
}
if ret.Err != "" {
err = errors.New(ret.Err)
}
return
}
type volumeDriverProxyRemoveRequest struct {
Name string
}
type volumeDriverProxyRemoveResponse struct {
Err string
}
func (pp *volumeDriverProxy) Remove(name string) (err error) {
var (
req volumeDriverProxyRemoveRequest
ret volumeDriverProxyRemoveResponse
)
req.Name = name
if err = pp.Call("VolumeDriver.Remove", req, &ret); err != nil {
return
}
if ret.Err != "" {
err = errors.New(ret.Err)
}
return
}
type volumeDriverProxyPathRequest struct {
Name string
}
type volumeDriverProxyPathResponse struct {
Mountpoint string
Err string
}
func (pp *volumeDriverProxy) Path(name string) (mountpoint string, err error) {
var (
req volumeDriverProxyPathRequest
ret volumeDriverProxyPathResponse
)
req.Name = name
if err = pp.Call("VolumeDriver.Path", req, &ret); err != nil {
return
}
mountpoint = ret.Mountpoint
if ret.Err != "" {
err = errors.New(ret.Err)
}
return
}
type volumeDriverProxyMountRequest struct {
Name string
ID string
}
type volumeDriverProxyMountResponse struct {
Mountpoint string
Err string
}
func (pp *volumeDriverProxy) Mount(name string, id string) (mountpoint string, err error) {
var (
req volumeDriverProxyMountRequest
ret volumeDriverProxyMountResponse
)
req.Name = name
req.ID = id
if err = pp.Call("VolumeDriver.Mount", req, &ret); err != nil {
return
}
mountpoint = ret.Mountpoint
if ret.Err != "" {
err = errors.New(ret.Err)
}
return
}
type volumeDriverProxyUnmountRequest struct {
Name string
ID string
}
type volumeDriverProxyUnmountResponse struct {
Err string
}
func (pp *volumeDriverProxy) Unmount(name string, id string) (err error) {
var (
req volumeDriverProxyUnmountRequest
ret volumeDriverProxyUnmountResponse
)
req.Name = name
req.ID = id
if err = pp.Call("VolumeDriver.Unmount", req, &ret); err != nil {
return
}
if ret.Err != "" {
err = errors.New(ret.Err)
}
return
}
type volumeDriverProxyListRequest struct {
}
type volumeDriverProxyListResponse struct {
Volumes []*proxyVolume
Err string
}
func (pp *volumeDriverProxy) List() (volumes []*proxyVolume, err error) {
var (
req volumeDriverProxyListRequest
ret volumeDriverProxyListResponse
)
if err = pp.Call("VolumeDriver.List", req, &ret); err != nil {
return
}
volumes = ret.Volumes
if ret.Err != "" {
err = errors.New(ret.Err)
}
return
}
type volumeDriverProxyGetRequest struct {
Name string
}
type volumeDriverProxyGetResponse struct {
Volume *proxyVolume
Err string
}
func (pp *volumeDriverProxy) Get(name string) (volume *proxyVolume, err error) {
var (
req volumeDriverProxyGetRequest
ret volumeDriverProxyGetResponse
)
req.Name = name
if err = pp.Call("VolumeDriver.Get", req, &ret); err != nil {
return
}
volume = ret.Volume
if ret.Err != "" {
err = errors.New(ret.Err)
}
return
}
type volumeDriverProxyCapabilitiesRequest struct {
}
type volumeDriverProxyCapabilitiesResponse struct {
Capabilities volume.Capability
Err string
}
func (pp *volumeDriverProxy) Capabilities() (capabilities volume.Capability, err error) {
var (
req volumeDriverProxyCapabilitiesRequest
ret volumeDriverProxyCapabilitiesResponse
)
if err = pp.Call("VolumeDriver.Capabilities", req, &ret); err != nil {
return
}
capabilities = ret.Capabilities
if ret.Err != "" {
err = errors.New(ret.Err)
}
return
}