diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-09-06 13:48:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-06 13:48:33 +0200 |
commit | 0d8a22496e3c7e3d44251bdbac194c55de141e2c (patch) | |
tree | c3591e9470b5b90842e6764b71b3e3988bc8fab5 /libpod/volume_internal.go | |
parent | a4572c4f681ef23495495f313ae513d5ba3fd495 (diff) | |
parent | de9a394fcff19ae4422a3f65502c8790787351fd (diff) | |
download | podman-0d8a22496e3c7e3d44251bdbac194c55de141e2c.tar.gz podman-0d8a22496e3c7e3d44251bdbac194c55de141e2c.tar.bz2 podman-0d8a22496e3c7e3d44251bdbac194c55de141e2c.zip |
Merge pull request #3931 from mheon/volumes_with_options
Add support for mounting volumes with local driver and options
Diffstat (limited to 'libpod/volume_internal.go')
-rw-r--r-- | libpod/volume_internal.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libpod/volume_internal.go b/libpod/volume_internal.go index 35f0ca19d..2e886e1b0 100644 --- a/libpod/volume_internal.go +++ b/libpod/volume_internal.go @@ -3,6 +3,8 @@ package libpod import ( "os" "path/filepath" + + "github.com/containers/libpod/libpod/define" ) // Creates a new volume @@ -20,3 +22,25 @@ func newVolume(runtime *Runtime) (*Volume, error) { func (v *Volume) teardownStorage() error { return os.RemoveAll(filepath.Join(v.runtime.config.VolumePath, v.Name())) } + +// Volumes with options set, or a filesystem type, or a device to mount need to +// be mounted and unmounted. +func (v *Volume) needsMount() bool { + return len(v.config.Options) > 0 && v.config.Driver == define.VolumeDriverLocal +} + +// update() updates the volume state from the DB. +func (v *Volume) update() error { + if err := v.runtime.state.UpdateVolume(v); err != nil { + return err + } + if !v.valid { + return define.ErrVolumeRemoved + } + return nil +} + +// save() saves the volume state to the DB +func (v *Volume) save() error { + return v.runtime.state.SaveVolume(v) +} |