diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-08-23 14:01:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-23 14:01:20 -0400 |
commit | 90cf78b199772082025f22e4ebc0e30c133d2a88 (patch) | |
tree | e890e717d5b5ce7bc51821776607464a7759271d /pkg/domain/infra/abi/volumes.go | |
parent | 6a3741598cc30216a1a8db7d2c917e19bc37002b (diff) | |
parent | edddfe8c4f7761b12dc64ea4aa0a83b755aa124f (diff) | |
download | podman-90cf78b199772082025f22e4ebc0e30c133d2a88.tar.gz podman-90cf78b199772082025f22e4ebc0e30c133d2a88.tar.bz2 podman-90cf78b199772082025f22e4ebc0e30c133d2a88.zip |
Merge pull request #11290 from flouthoc/volume-export
volumes: Add support for `volume export` which allows exporting content to external path.
Diffstat (limited to 'pkg/domain/infra/abi/volumes.go')
-rw-r--r-- | pkg/domain/infra/abi/volumes.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/volumes.go b/pkg/domain/infra/abi/volumes.go index e077b10ea..1610c0b48 100644 --- a/pkg/domain/infra/abi/volumes.go +++ b/pkg/domain/infra/abi/volumes.go @@ -162,3 +162,19 @@ func (ic *ContainerEngine) VolumeExists(ctx context.Context, nameOrID string) (* } return &entities.BoolReport{Value: exists}, nil } + +// Volumemounted check if a given volume using plugin or filesystem is mounted or not. +func (ic *ContainerEngine) VolumeMounted(ctx context.Context, nameOrID string) (*entities.BoolReport, error) { + vol, err := ic.Libpod.LookupVolume(nameOrID) + if err != nil { + return nil, err + } + mountCount, err := vol.MountCount() + if err != nil { + return &entities.BoolReport{Value: false}, nil + } + if mountCount > 0 { + return &entities.BoolReport{Value: true}, nil + } + return &entities.BoolReport{Value: false}, nil +} |