mirror of
https://github.com/containers/podman.git
synced 2025-12-02 11:08:36 +08:00
Also, do a general cleanup of all the timeout code. Changes include: - Convert from int to *uint where possible. Timeouts cannot be negative, hence the uint change; and a timeout of 0 is valid, so we need a new way to detect that the user set a timeout (hence, pointer). - Change name in the database to avoid conflicts between new data type and old one. This will cause timeouts set with 4.2.0 to be lost, but considering nobody is using the feature at present (and the lack of validation means we could have invalid, negative timeouts in the DB) this feels safe. - Ensure volume plugin timeouts can only be used with volumes created using a plugin. Timeouts on the local driver are nonsensical. - Remove the existing test, as it did not use a volume plugin. Write a new test that does. The actual plumbing of the containers.conf timeout in is one line in volume_api.go; the remainder are the above-described cleanups. Signed-off-by: Matthew Heon <mheon@redhat.com>
52 lines
1.3 KiB
Go
52 lines
1.3 KiB
Go
package config
|
|
|
|
import "os"
|
|
|
|
// getDefaultImage returns the default machine image stream
|
|
// On Windows this refers to the Fedora major release number
|
|
func getDefaultMachineImage() string {
|
|
return "35"
|
|
}
|
|
|
|
// getDefaultMachineUser returns the user to use for rootless podman
|
|
func getDefaultMachineUser() string {
|
|
return "user"
|
|
}
|
|
|
|
// isCgroup2UnifiedMode returns whether we are running in cgroup2 mode.
|
|
func isCgroup2UnifiedMode() (isUnified bool, isUnifiedErr error) {
|
|
return false, nil
|
|
}
|
|
|
|
// getDefaultProcessLimits returns the nofile and nproc for the current process in ulimits format
|
|
func getDefaultProcessLimits() []string {
|
|
return []string{}
|
|
}
|
|
|
|
// getDefaultTmpDir for windows
|
|
func getDefaultTmpDir() string {
|
|
// first check the Temp env var
|
|
// https://answers.microsoft.com/en-us/windows/forum/all/where-is-the-temporary-folder/44a039a5-45ba-48dd-84db-fd700e54fd56
|
|
if val, ok := os.LookupEnv("TEMP"); ok {
|
|
return val
|
|
}
|
|
return os.Getenv("LOCALAPPDATA") + "\\Temp"
|
|
}
|
|
|
|
func getDefaultCgroupsMode() string {
|
|
return "enabled"
|
|
}
|
|
|
|
func getDefaultLockType() string {
|
|
return "shm"
|
|
}
|
|
|
|
func getLibpodTmpDir() string {
|
|
return "/run/libpod"
|
|
}
|
|
|
|
// getDefaultMachineVolumes returns default mounted volumes (possibly with env vars, which will be expanded)
|
|
func getDefaultMachineVolumes() []string {
|
|
return []string{}
|
|
}
|