mirror of
https://github.com/containers/podman.git
synced 2025-07-01 00:01:02 +08:00
runtime: Handle the transient store options
This handles the transient store options from the container/storage configuration in the runtime/engine. Changes are: * Print transient store status in `podman info` * Print transient store status in runtime debug output * Add --transient-store argument to override config option * Propagate config state to conmon cleanup args so the callback podman gets the same config. Note: This doesn't really change any behaviour yet (other than the changes in containers/storage). Signed-off-by: Alexander Larsson <alexl@redhat.com>
This commit is contained in:
@ -464,6 +464,8 @@ func rootFlags(cmd *cobra.Command, podmanConfig *entities.PodmanConfig) {
|
||||
pFlags.StringVar(&podmanConfig.Runroot, runrootFlagName, "", "Path to the 'run directory' where all state information is stored")
|
||||
_ = cmd.RegisterFlagCompletionFunc(runrootFlagName, completion.AutocompleteDefault)
|
||||
|
||||
pFlags.BoolVar(&podmanConfig.TransientStore, "transient-store", false, "Enable transient container storage")
|
||||
|
||||
runtimeFlagName := "runtime"
|
||||
pFlags.StringVar(&podmanConfig.RuntimePath, runtimeFlagName, podmanConfig.ContainersConfDefaultsRO.Engine.OCIRuntime, "Path to the OCI-compatible binary used to run containers.")
|
||||
_ = cmd.RegisterFlagCompletionFunc(runtimeFlagName, completion.AutocompleteDefault)
|
||||
|
@ -146,6 +146,7 @@ store:
|
||||
imageStore:
|
||||
number: 5
|
||||
runRoot: /run/user/3267/containers
|
||||
transientStore: false
|
||||
volumePath: /home/dwalsh/.local/share/containers/storage/volumes
|
||||
version:
|
||||
APIVersion: 4.0.0
|
||||
@ -263,7 +264,8 @@ $ podman info --format json
|
||||
"number": 5
|
||||
},
|
||||
"runRoot": "/run/user/3267/containers",
|
||||
"volumePath": "/home/dwalsh/.local/share/containers/storage/volumes"
|
||||
"volumePath": "/home/dwalsh/.local/share/containers/storage/volumes",
|
||||
"transientStore": false
|
||||
},
|
||||
"registries": {
|
||||
"search": [
|
||||
|
@ -162,6 +162,14 @@ Path to the tmp directory, for libpod runtime content. Defaults to `$XDG_RUNTIME
|
||||
|
||||
NOTE --tmpdir is not used for the temporary storage of downloaded images. Use the environment variable `TMPDIR` to change the temporary storage location of downloaded container images. Podman defaults to use `/var/tmp`.
|
||||
|
||||
#### **--transient-store**
|
||||
|
||||
Enables a global transient storaga mode where all container metadata is stored on non-persistant media (i.e. in the location specified by `--runroot`).
|
||||
This mode allows starting containers faster, as well as guaranteeing a fresh state on boot in case of unclean shutdowns or other problems. However
|
||||
it is not compabible with a traditional model where containers persist across reboots.
|
||||
|
||||
Default value for this is configured in `/etc/containers/storage.conf`.
|
||||
|
||||
#### **--url**=*value*
|
||||
URL to access Podman service (default from `containers.conf`, rootless `unix://run/user/$UID/podman/podman.sock` or as root `unix://run/podman/podman.sock`).
|
||||
Setting this option will switch the **--remote** option to true.
|
||||
|
@ -118,6 +118,7 @@ type StoreInfo struct {
|
||||
ImageStore ImageStore `json:"imageStore"`
|
||||
RunRoot string `json:"runRoot"`
|
||||
VolumePath string `json:"volumePath"`
|
||||
TransientStore bool `json:"transientStore"`
|
||||
}
|
||||
|
||||
// ImageStore describes the image store. Right now only the number
|
||||
|
@ -226,6 +226,7 @@ func (r *Runtime) storeInfo() (*define.StoreInfo, error) {
|
||||
GraphOptions: nil,
|
||||
VolumePath: r.config.Engine.VolumePath,
|
||||
ConfigFile: configFile,
|
||||
TransientStore: r.store.TransientStore(),
|
||||
}
|
||||
|
||||
graphOptions := map[string]interface{}{}
|
||||
|
@ -109,6 +109,18 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption {
|
||||
}
|
||||
}
|
||||
|
||||
func WithTransientStore(transientStore bool) RuntimeOption {
|
||||
return func(rt *Runtime) error {
|
||||
if rt.valid {
|
||||
return define.ErrRuntimeFinalized
|
||||
}
|
||||
|
||||
rt.storageConfig.TransientStore = transientStore
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithSignaturePolicy specifies the path of a file which decides how trust is
|
||||
// managed for images we've pulled.
|
||||
// If this is not specified, the system default configuration will be used
|
||||
|
@ -396,6 +396,7 @@ func makeRuntime(runtime *Runtime) (retErr error) {
|
||||
logrus.Debugf("Using static dir %s", runtime.config.Engine.StaticDir)
|
||||
logrus.Debugf("Using tmp dir %s", runtime.config.Engine.TmpDir)
|
||||
logrus.Debugf("Using volume path %s", runtime.config.Engine.VolumePath)
|
||||
logrus.Debugf("Using transient store: %v", runtime.storageConfig.TransientStore)
|
||||
|
||||
// Validate our config against the database, now that we've set our
|
||||
// final storage configuration
|
||||
|
@ -55,4 +55,5 @@ type PodmanConfig struct {
|
||||
StorageOpts []string
|
||||
SSHMode string
|
||||
MachineMode bool
|
||||
TransientStore bool
|
||||
}
|
||||
|
@ -171,6 +171,9 @@ func getRuntime(ctx context.Context, fs *flag.FlagSet, opts *engineOpts) (*libpo
|
||||
storageOpts.GraphDriverOptions = cfg.StorageOpts
|
||||
}
|
||||
}
|
||||
if fs.Changed("transient-store") {
|
||||
options = append(options, libpod.WithTransientStore(cfg.TransientStore))
|
||||
}
|
||||
if opts.migrate {
|
||||
options = append(options, libpod.WithMigrate())
|
||||
if opts.name != "" {
|
||||
|
@ -282,6 +282,7 @@ func CreateExitCommandArgs(storageConfig storageTypes.StoreOptions, config *conf
|
||||
"--network-config-dir", config.Network.NetworkConfigDir,
|
||||
"--network-backend", config.Network.NetworkBackend,
|
||||
"--volumepath", config.Engine.VolumePath,
|
||||
fmt.Sprintf("--transient-store=%t", storageConfig.TransientStore),
|
||||
}
|
||||
if config.Engine.OCIRuntime != "" {
|
||||
command = append(command, []string{"--runtime", config.Engine.OCIRuntime}...)
|
||||
|
Reference in New Issue
Block a user