mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-10-13 17:37:42 +00:00
The processing and setting of the static and volume directories was scattered across the code base (including c/common) leading to subtle errors that surfaced in #19938. There were multiple issues that I try to summarize below: - c/common loaded the graphroot from c/storage to set the defaults for static and volume dir. That ignored Podman's --root flag and surfaced in #19938 and other bugs. c/common does not set the defaults anymore which gives Podman the ability to detect when the user/admin configured a custom directory (not empty value). - When parsing the CLI, Podman (ab)uses containers.conf structures to set the defaults but also to override them in case the user specified a flag. The --root flag overrode the static dir which is wrong and broke a couple of use cases. Now there is a dedicated field for in the "PodmanConfig" which also includes a containers.conf struct. - The defaults for static and volume dir and now being set correctly and adhere to --root. - The CONTAINERS_CONF_OVERRIDE env variable has not been passed to the cleanup process. I believe that _all_ env variables should be passed to conmon to avoid such subtle bugs. Overall I find that the code and logic is scattered and hard to understand and follow. I refrained from larger refactorings as I really just want to get #19938 fixed and then go back to other priorities. https://github.com/containers/common/pull/1659 broke three pkg/machine tests. Those have been commented out until getting fixed. Fixes: #19938 Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
62 lines
2.4 KiB
Go
62 lines
2.4 KiB
Go
package entities
|
|
|
|
import (
|
|
"github.com/containers/common/pkg/config"
|
|
"github.com/spf13/pflag"
|
|
)
|
|
|
|
// EngineMode is the connection type podman is using to access libpod
|
|
type EngineMode string
|
|
|
|
// EngineSetup calls out whether a "normal" or specialized engine should be created
|
|
type EngineSetup string
|
|
|
|
const (
|
|
ABIMode = EngineMode("abi")
|
|
TunnelMode = EngineMode("tunnel")
|
|
|
|
MigrateMode = EngineSetup("migrate")
|
|
NoFDsMode = EngineSetup("disablefds")
|
|
NormalMode = EngineSetup("normal")
|
|
RenumberMode = EngineSetup("renumber")
|
|
ResetMode = EngineSetup("reset")
|
|
)
|
|
|
|
// Convert EngineMode to String
|
|
func (m EngineMode) String() string {
|
|
return string(m)
|
|
}
|
|
|
|
// PodmanConfig combines the defaults and settings from the file system with the
|
|
// flags given in os.Args. Some runtime state is also stored here.
|
|
type PodmanConfig struct {
|
|
*pflag.FlagSet
|
|
|
|
ContainersConf *config.Config
|
|
ContainersConfDefaultsRO *config.Config // The read-only! defaults from containers.conf.
|
|
DBBackend string // Hidden: change the database backend
|
|
DockerConfig string // Used for Docker compatibility
|
|
CgroupUsage string // rootless code determines Usage message
|
|
ConmonPath string // --conmon flag will set Engine.ConmonPath
|
|
CPUProfile string // Hidden: Should CPU profile be taken
|
|
EngineMode EngineMode // ABI or Tunneling mode
|
|
Identity string // ssh identity for connecting to server
|
|
MaxWorks int // maximum number of parallel threads
|
|
MemoryProfile string // Hidden: Should memory profile be taken
|
|
RegistriesConf string // allows for specifying a custom registries.conf
|
|
Remote bool // Connection to Podman API Service will use RESTful API
|
|
RuntimePath string // --runtime flag will set Engine.RuntimePath
|
|
RuntimeFlags []string // global flags for the container runtime
|
|
Syslog bool // write logging information to syslog as well as the console
|
|
Trace bool // Hidden: Trace execution
|
|
URI string // URI to RESTful API Service
|
|
|
|
Runroot string
|
|
ImageStore string
|
|
StorageDriver string
|
|
StorageOpts []string
|
|
SSHMode string
|
|
MachineMode bool
|
|
TransientStore bool
|
|
GraphRoot string
|
|
}
|