diff options
Diffstat (limited to 'pkg/domain/infra/abi/volumes.go')
-rw-r--r-- | pkg/domain/infra/abi/volumes.go | 32 |
1 files changed, 32 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 +} |