When in transient store mode, use rundir for bundlepath

This means we store things like config.json and the secret files
also on tmpfs, lowering wear on disk and leaving less stuff on disk
on an unclean shutdown.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
This commit is contained in:
Alexander Larsson
2022-12-21 10:24:47 +01:00
parent 90ba443472
commit 3808067ff8
2 changed files with 4 additions and 0 deletions

View File

@ -128,6 +128,9 @@ func (c *Container) rwSize() (int64, error) {
// bundlePath returns the path to the container's root filesystem - where the OCI spec will be // bundlePath returns the path to the container's root filesystem - where the OCI spec will be
// placed, amongst other things // placed, amongst other things
func (c *Container) bundlePath() string { func (c *Container) bundlePath() string {
if c.runtime.storageConfig.TransientStore {
return c.state.RunDir
}
return c.config.StaticDir return c.config.StaticDir
} }

View File

@ -118,6 +118,7 @@ func TestPostDeleteHooks(t *testing.T) {
statePath := filepath.Join(dir, "state") statePath := filepath.Join(dir, "state")
copyPath := filepath.Join(dir, "copy") copyPath := filepath.Join(dir, "copy")
c := Container{ c := Container{
runtime: &Runtime{},
config: &ContainerConfig{ config: &ContainerConfig{
ID: "123abc", ID: "123abc",
Spec: &rspec.Spec{ Spec: &rspec.Spec{