summaryrefslogtreecommitdiff
path: root/pkg/domain/infra
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-02-16 06:04:22 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2022-02-28 14:26:22 -0500
commit3dc1b8e83f2459a58d65f3bb918975cd6f1bb794 (patch)
tree15a3d902665203a36ad06965e79997434567e8c5 /pkg/domain/infra
parentc39dffe83db9fa3cfa6897b971956821f1bbcce2 (diff)
downloadpodman-3dc1b8e83f2459a58d65f3bb918975cd6f1bb794.tar.gz
podman-3dc1b8e83f2459a58d65f3bb918975cd6f1bb794.tar.bz2
podman-3dc1b8e83f2459a58d65f3bb918975cd6f1bb794.zip
Add podman volume mount support
Fixes: https://github.com/containers/podman/issues/12768 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/domain/infra')
-rw-r--r--pkg/domain/infra/abi/volumes.go32
-rw-r--r--pkg/domain/infra/tunnel/volumes.go8
2 files changed, 40 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/volumes.go b/pkg/domain/infra/abi/volumes.go
index ee7269807..19fc6d2d3 100644
--- a/pkg/domain/infra/abi/volumes.go
+++ b/pkg/domain/infra/abi/volumes.go
@@ -178,3 +178,35 @@ func (ic *ContainerEngine) VolumeMounted(ctx context.Context, nameOrID string) (
}
return &entities.BoolReport{Value: false}, nil
}
+
+func (ic *ContainerEngine) VolumeMount(ctx context.Context, nameOrIDs []string) ([]*entities.VolumeMountReport, error) {
+ reports := []*entities.VolumeMountReport{}
+ for _, name := range nameOrIDs {
+ report := entities.VolumeMountReport{Id: name}
+ vol, err := ic.Libpod.LookupVolume(name)
+ if err != nil {
+ report.Err = err
+ } else {
+ report.Path, report.Err = vol.Mount()
+ }
+ reports = append(reports, &report)
+ }
+
+ return reports, nil
+}
+
+func (ic *ContainerEngine) VolumeUnmount(ctx context.Context, nameOrIDs []string) ([]*entities.VolumeUnmountReport, error) {
+ reports := []*entities.VolumeUnmountReport{}
+ for _, name := range nameOrIDs {
+ report := entities.VolumeUnmountReport{Id: name}
+ vol, err := ic.Libpod.LookupVolume(name)
+ if err != nil {
+ report.Err = err
+ } else {
+ report.Err = vol.Unmount()
+ }
+ reports = append(reports, &report)
+ }
+
+ return reports, nil
+}
diff --git a/pkg/domain/infra/tunnel/volumes.go b/pkg/domain/infra/tunnel/volumes.go
index f4abeab0f..33e090148 100644
--- a/pkg/domain/infra/tunnel/volumes.go
+++ b/pkg/domain/infra/tunnel/volumes.go
@@ -100,3 +100,11 @@ func (ic *ContainerEngine) VolumeExists(ctx context.Context, nameOrID string) (*
func (ic *ContainerEngine) VolumeMounted(ctx context.Context, nameOrID string) (*entities.BoolReport, error) {
return nil, errors.New("not implemented")
}
+
+func (ic *ContainerEngine) VolumeMount(ctx context.Context, nameOrIDs []string) ([]*entities.VolumeMountReport, error) {
+ return nil, errors.New("mounting volumes is not supported for remote clients")
+}
+
+func (ic *ContainerEngine) VolumeUnmount(ctx context.Context, nameOrIDs []string) ([]*entities.VolumeUnmountReport, error) {
+ return nil, errors.New("unmounting volumes is not supported for remote clients")
+}