mirror of
https://github.com/containers/podman.git
synced 2025-06-21 09:28:09 +08:00
Merge pull request #13981 from rhatdan/volume
Add support for passing --volumepath
This commit is contained in:
@ -429,6 +429,10 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
|
|||||||
|
|
||||||
pFlags.BoolVar(&opts.Trace, "trace", false, "Enable opentracing output (default false)")
|
pFlags.BoolVar(&opts.Trace, "trace", false, "Enable opentracing output (default false)")
|
||||||
|
|
||||||
|
volumePathFlagName := "volumepath"
|
||||||
|
pFlags.StringVar(&opts.Engine.VolumePath, volumePathFlagName, "", "Path to the volume directory in which volume data is stored")
|
||||||
|
_ = cmd.RegisterFlagCompletionFunc(volumePathFlagName, completion.AutocompleteDefault)
|
||||||
|
|
||||||
// Hide these flags for both ABI and Tunneling
|
// Hide these flags for both ABI and Tunneling
|
||||||
for _, f := range []string{
|
for _, f := range []string{
|
||||||
"cpu-profile",
|
"cpu-profile",
|
||||||
|
@ -193,6 +193,10 @@ Some example URL values in valid formats:
|
|||||||
|
|
||||||
Print the version
|
Print the version
|
||||||
|
|
||||||
|
#### **--volumepath**=*value*
|
||||||
|
|
||||||
|
Volume directory where builtin volume information is stored (default: "/var/lib/containers/storage/volumes" for UID 0, "$HOME/.local/share/containers/storage/volumes" for other users). Default volume path can be overridden in `containers.conf`.
|
||||||
|
|
||||||
## Environment Variables
|
## Environment Variables
|
||||||
|
|
||||||
Podman can set up environment variables from env of [engine] table in containers.conf. These variables can be overridden by passing environment variables before the `podman` commands.
|
Podman can set up environment variables from env of [engine] table in containers.conf. These variables can be overridden by passing environment variables before the `podman` commands.
|
||||||
|
@ -209,6 +209,10 @@ func getRuntime(ctx context.Context, fs *flag.FlagSet, opts *engineOpts) (*libpo
|
|||||||
options = append(options, libpod.WithEventsLogger(cfg.Engine.EventsLogger))
|
options = append(options, libpod.WithEventsLogger(cfg.Engine.EventsLogger))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fs.Changed("volumepath") {
|
||||||
|
options = append(options, libpod.WithVolumePath(cfg.Engine.VolumePath))
|
||||||
|
}
|
||||||
|
|
||||||
if fs.Changed("cgroup-manager") {
|
if fs.Changed("cgroup-manager") {
|
||||||
options = append(options, libpod.WithCgroupManager(cfg.Engine.CgroupManager))
|
options = append(options, libpod.WithCgroupManager(cfg.Engine.CgroupManager))
|
||||||
} else {
|
} else {
|
||||||
|
@ -281,6 +281,7 @@ func CreateExitCommandArgs(storageConfig storageTypes.StoreOptions, config *conf
|
|||||||
"--tmpdir", config.Engine.TmpDir,
|
"--tmpdir", config.Engine.TmpDir,
|
||||||
"--network-config-dir", config.Network.NetworkConfigDir,
|
"--network-config-dir", config.Network.NetworkConfigDir,
|
||||||
"--network-backend", config.Network.NetworkBackend,
|
"--network-backend", config.Network.NetworkBackend,
|
||||||
|
"--volumepath", config.Engine.VolumePath,
|
||||||
}
|
}
|
||||||
if config.Engine.OCIRuntime != "" {
|
if config.Engine.OCIRuntime != "" {
|
||||||
command = append(command, []string{"--runtime", config.Engine.OCIRuntime}...)
|
command = append(command, []string{"--runtime", config.Engine.OCIRuntime}...)
|
||||||
|
@ -107,4 +107,12 @@ host.slirp4netns.executable | $expr_path
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "podman --root PATH --volumepath info - basic output" {
|
||||||
|
volumePath=${PODMAN_TMPDIR}/volumesGoHere
|
||||||
|
if ! is_remote; then
|
||||||
|
run_podman --storage-driver=vfs --root ${PODMAN_TMPDIR}/nothing-here-move-along --volumepath ${volumePath} info --format '{{ .Store.VolumePath }}'
|
||||||
|
is "$output" "${volumePath}" "'podman --volumepath should reset VolumePath"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# vim: filetype=sh
|
# vim: filetype=sh
|
||||||
|
Reference in New Issue
Block a user