Merge pull request #6241 from jterry75/main
Add support for TMP override on toml
This commit is contained in:
commit
af93ea7f1e
@ -39,6 +39,8 @@ type Config struct {
|
|||||||
Root string `toml:"root"`
|
Root string `toml:"root"`
|
||||||
// State is the path to a directory where containerd will store transient data
|
// State is the path to a directory where containerd will store transient data
|
||||||
State string `toml:"state"`
|
State string `toml:"state"`
|
||||||
|
// TempDir is the path to a directory where to place containerd temporary files
|
||||||
|
TempDir string `toml:"temp"`
|
||||||
// PluginDir is the directory for dynamic plugins to be stored
|
// PluginDir is the directory for dynamic plugins to be stored
|
||||||
PluginDir string `toml:"plugin_dir"`
|
PluginDir string `toml:"plugin_dir"`
|
||||||
// GRPC configuration settings
|
// GRPC configuration settings
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"net/http/pprof"
|
"net/http/pprof"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -75,7 +76,28 @@ func CreateTopLevelDirectories(config *srvconfig.Config) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return sys.MkdirAllWithACL(config.State, 0711)
|
if err := sys.MkdirAllWithACL(config.State, 0711); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if config.TempDir != "" {
|
||||||
|
if err := sys.MkdirAllWithACL(config.TempDir, 0711); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
// On Windows, the Host Compute Service (vmcompute) will read the
|
||||||
|
// TEMP/TMP setting from the calling process when creating the
|
||||||
|
// tempdir to extract an image layer to. This allows the
|
||||||
|
// administrator to align the tempdir location with the same volume
|
||||||
|
// as the snapshot dir to avoid a copy operation when moving the
|
||||||
|
// extracted layer to the snapshot dir location.
|
||||||
|
os.Setenv("TEMP", config.TempDir)
|
||||||
|
os.Setenv("TMP", config.TempDir)
|
||||||
|
} else {
|
||||||
|
os.Setenv("TMPDIR", config.TempDir)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates and initializes a new containerd server
|
// New creates and initializes a new containerd server
|
||||||
|
Loading…
Reference in New Issue
Block a user