summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2021-05-05 15:44:29 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2021-05-05 17:58:39 +0200
commit68fe1950fe5bad7e29b7a75bb1e94a54fd7e5360 (patch)
tree8d8967ca6df08ce77e8aef98f391327fd23aec3c /pkg/specgen
parent4d2ba323f2e67fbfd6150582196c6e0229c70a8e (diff)
downloadpodman-68fe1950fe5bad7e29b7a75bb1e94a54fd7e5360.tar.gz
podman-68fe1950fe5bad7e29b7a75bb1e94a54fd7e5360.tar.bz2
podman-68fe1950fe5bad7e29b7a75bb1e94a54fd7e5360.zip
podman: set volatile storage flag for --rm containers
volatile containers are a storage optimization that disables *sync() syscalls for the container rootfs. If a container is created with --rm, then automatically set the volatile storage flag as anyway the container won't persist after a reboot or machine crash. [NO TESTS NEEDED] Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/generate/container_create.go3
-rw-r--r--pkg/specgen/specgen.go3
2 files changed, 6 insertions, 0 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go
index 277435ef1..2dfca82d7 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -194,6 +194,9 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen.
if s.Umask != "" {
options = append(options, libpod.WithUmask(s.Umask))
}
+ if s.Volatile {
+ options = append(options, libpod.WithVolatile())
+ }
useSystemd := false
switch s.Systemd {
diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go
index fdcb7a0e0..5ef2b0653 100644
--- a/pkg/specgen/specgen.go
+++ b/pkg/specgen/specgen.go
@@ -256,6 +256,9 @@ type ContainerStorageConfig struct {
// Secrets are the secrets that will be added to the container
// Optional.
Secrets []string `json:"secrets,omitempty"`
+ // Volatile specifies whether the container storage can be optimized
+ // at the cost of not syncing all the dirty files in memory.
+ Volatile bool `json:"volatile,omitempty"`
}
// ContainerSecurityConfig is a container's security features, including