mirror of
https://github.com/containers/podman.git
synced 2025-06-25 12:20:42 +08:00
Merge pull request #9911 from rhatdan/storage
Allow users to override default storage opts with --storage-opt
This commit is contained in:
@ -148,7 +148,7 @@ specify additional options via the `--storage-opt` flag.
|
|||||||
|
|
||||||
#### **\-\-storage-opt**=*value*
|
#### **\-\-storage-opt**=*value*
|
||||||
|
|
||||||
Storage driver option, Default storage driver options are configured in /etc/containers/storage.conf (`$HOME/.config/containers/storage.conf` in rootless mode). The `STORAGE_OPTS` environment variable overrides the default. The --storage-opt specified options overrides all.
|
Storage driver option, Default storage driver options are configured in /etc/containers/storage.conf (`$HOME/.config/containers/storage.conf` in rootless mode). The `STORAGE_OPTS` environment variable overrides the default. The --storage-opt specified options overrides all. If you specify --storage-opt="", no storage options will be used.
|
||||||
|
|
||||||
#### **\-\-syslog**=*true|false*
|
#### **\-\-syslog**=*true|false*
|
||||||
|
|
||||||
|
@ -77,8 +77,7 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption {
|
|||||||
rt.storageConfig.GraphDriverOptions = make([]string, len(config.GraphDriverOptions))
|
rt.storageConfig.GraphDriverOptions = make([]string, len(config.GraphDriverOptions))
|
||||||
copy(rt.storageConfig.GraphDriverOptions, config.GraphDriverOptions)
|
copy(rt.storageConfig.GraphDriverOptions, config.GraphDriverOptions)
|
||||||
} else {
|
} else {
|
||||||
// append new options after what is specified in the config files
|
rt.storageConfig.GraphDriverOptions = config.GraphDriverOptions
|
||||||
rt.storageConfig.GraphDriverOptions = append(rt.storageConfig.GraphDriverOptions, config.GraphDriverOptions...)
|
|
||||||
}
|
}
|
||||||
setField = true
|
setField = true
|
||||||
}
|
}
|
||||||
|
@ -146,8 +146,12 @@ func getRuntime(ctx context.Context, fs *flag.FlagSet, opts *engineOpts) (*libpo
|
|||||||
// This should always be checked after storage-driver is checked
|
// This should always be checked after storage-driver is checked
|
||||||
if len(cfg.StorageOpts) > 0 {
|
if len(cfg.StorageOpts) > 0 {
|
||||||
storageSet = true
|
storageSet = true
|
||||||
|
if len(cfg.StorageOpts) == 1 && cfg.StorageOpts[0] == "" {
|
||||||
|
storageOpts.GraphDriverOptions = []string{}
|
||||||
|
} else {
|
||||||
storageOpts.GraphDriverOptions = cfg.StorageOpts
|
storageOpts.GraphDriverOptions = cfg.StorageOpts
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if opts.migrate {
|
if opts.migrate {
|
||||||
options = append(options, libpod.WithMigrate())
|
options = append(options, libpod.WithMigrate())
|
||||||
if opts.name != "" {
|
if opts.name != "" {
|
||||||
|
@ -53,4 +53,13 @@ store.imageStore.number | 1
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "podman info --storage-opt='' " {
|
||||||
|
skip_if_remote "--storage-opt flag is not supported for remote"
|
||||||
|
skip_if_rootless "storage opts are required for rootless running"
|
||||||
|
run_podman --storage-opt='' info
|
||||||
|
# Note this will not work in rootless mode, unless you specify
|
||||||
|
# storage-driver=vfs, until we have kernels that support rootless overlay
|
||||||
|
# mounts.
|
||||||
|
is "$output" ".*graphOptions: {}" "output includes graphOptions: {}"
|
||||||
|
}
|
||||||
# vim: filetype=sh
|
# vim: filetype=sh
|
||||||
|
Reference in New Issue
Block a user