diff options
author | Matthew Heon <matthew.heon@pm.me> | 2020-01-29 14:04:51 -0500 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-01-29 14:04:51 -0500 |
commit | 5d93c731afd5b21d88c025069da0e82455f09445 (patch) | |
tree | 13a1b91a692e8164b70fbdfeec16e7191b45f8d6 /libpod/options.go | |
parent | 955866c97da3007be20a6812eb8afa48e9833d23 (diff) | |
download | podman-5d93c731afd5b21d88c025069da0e82455f09445.tar.gz podman-5d93c731afd5b21d88c025069da0e82455f09445.tar.bz2 podman-5d93c731afd5b21d88c025069da0e82455f09445.zip |
Deprecate & remove IsCtrSpecific in favor of IsAnon
In Podman 1.6.3, we added support for anonymous volumes - fixing
our old, broken support for named volumes that were created with
containers. Unfortunately, this reused the database field we used
for the old implementation, and toggled volume removal on for
`podman run --rm` - so now, we were removing *named* volumes
created with older versions of Podman.
We can't modify these old volumes in the DB, so the next-safest
thing to do is swap to a new field to indicate volumes should be
removed. Problem: Volumes created with 1.6.3 and up until this
lands, even anonymous volumes, will not be removed. However, this
is safer than removing too many volumes, as we were doing before.
Fixes #5009
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/options.go')
-rw-r--r-- | libpod/options.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libpod/options.go b/libpod/options.go index 593037382..923e7292c 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -1546,17 +1546,16 @@ func WithVolumeGID(gid int) VolumeCreateOption { } } -// withSetCtrSpecific sets a bool notifying libpod that a volume was created -// specifically for a container. -// These volumes will be removed when the container is removed and volumes are -// also specified for removal. -func withSetCtrSpecific() VolumeCreateOption { +// withSetAnon sets a bool notifying libpod that this volume is anonymous and +// should be removed when containers using it are removed and volumes are +// specified for removal. +func withSetAnon() VolumeCreateOption { return func(volume *Volume) error { if volume.valid { return define.ErrVolumeFinalized } - volume.config.IsCtrSpecific = true + volume.config.IsAnon = true return nil } |