summaryrefslogtreecommitdiff
path: root/libpod/volume.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-01-29 14:04:51 -0500
committerMatthew Heon <matthew.heon@pm.me>2020-01-29 14:04:51 -0500
commit5d93c731afd5b21d88c025069da0e82455f09445 (patch)
tree13a1b91a692e8164b70fbdfeec16e7191b45f8d6 /libpod/volume.go
parent955866c97da3007be20a6812eb8afa48e9833d23 (diff)
downloadpodman-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/volume.go')
-rw-r--r--libpod/volume.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/libpod/volume.go b/libpod/volume.go
index c4771bbb8..1ffed872e 100644
--- a/libpod/volume.go
+++ b/libpod/volume.go
@@ -38,9 +38,8 @@ type VolumeConfig struct {
// a list of mount options. For other drivers, they are passed to the
// volume driver handling the volume.
Options map[string]string `json:"volumeOptions,omitempty"`
- // Whether this volume was created for a specific container and will be
- // removed with it.
- IsCtrSpecific bool `json:"ctrSpecific"`
+ // Whether this volume is anonymous (will be removed on container exit)
+ IsAnon bool `json:"isAnon"`
// UID the volume will be created as.
UID int `json:"uid"`
// GID the volume will be created as.
@@ -106,11 +105,10 @@ func (v *Volume) Options() map[string]string {
return options
}
-// IsCtrSpecific returns whether this volume was created specifically for a
-// given container. Images with this set to true will be removed when the
-// container is removed with the Volumes parameter set to true.
-func (v *Volume) IsCtrSpecific() bool {
- return v.config.IsCtrSpecific
+// Anonymous returns whether this volume is anonymous. Anonymous volumes were
+// created with a container, and will be removed when that container is removed.
+func (v *Volume) Anonymous() bool {
+ return v.config.IsAnon
}
// UID returns the UID the volume will be created as.