mirror of
https://github.com/containers/podman.git
synced 2025-10-20 20:54:45 +08:00
Drop podman create --storage-opt container flag
The global flag will work in either location, and this flag just breaks users expectations, and is basically a noop. Also fix global storage-opt so that podman-remote can use it. [NO TESTS NEEDED] Since it would be difficult to test in ci/cd. Fixes: https://github.com/containers/podman/issues/10264 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -655,15 +655,6 @@ func DefineCreateFlags(cmd *cobra.Command, cf *ContainerCLIOpts) {
|
|||||||
)
|
)
|
||||||
_ = cmd.RegisterFlagCompletionFunc(stopTimeoutFlagName, completion.AutocompleteNone)
|
_ = cmd.RegisterFlagCompletionFunc(stopTimeoutFlagName, completion.AutocompleteNone)
|
||||||
|
|
||||||
storageOptFlagName := "storage-opt"
|
|
||||||
createFlags.StringSliceVar(
|
|
||||||
&cf.StorageOpt,
|
|
||||||
storageOptFlagName, []string{},
|
|
||||||
"Storage driver options per container",
|
|
||||||
)
|
|
||||||
//FIXME: What should we suggest here? The flag is not in the man page.
|
|
||||||
_ = cmd.RegisterFlagCompletionFunc(storageOptFlagName, completion.AutocompleteNone)
|
|
||||||
|
|
||||||
subgidnameFlagName := "subgidname"
|
subgidnameFlagName := "subgidname"
|
||||||
createFlags.StringVar(
|
createFlags.StringVar(
|
||||||
&cf.SubUIDName,
|
&cf.SubUIDName,
|
||||||
|
@ -146,6 +146,8 @@ func replaceContainer(name string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createInit(c *cobra.Command) error {
|
func createInit(c *cobra.Command) error {
|
||||||
|
cliVals.StorageOpt = registry.PodmanConfig().StorageOpts
|
||||||
|
|
||||||
if c.Flag("shm-size").Changed {
|
if c.Flag("shm-size").Changed {
|
||||||
cliVals.ShmSize = c.Flag("shm-size").Value.String()
|
cliVals.ShmSize = c.Flag("shm-size").Value.String()
|
||||||
}
|
}
|
||||||
|
@ -342,10 +342,6 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
|
|||||||
pFlags.StringVar(&opts.StorageDriver, storageDriverFlagName, "", "Select which storage driver is used to manage storage of images and containers (default is overlay)")
|
pFlags.StringVar(&opts.StorageDriver, storageDriverFlagName, "", "Select which storage driver is used to manage storage of images and containers (default is overlay)")
|
||||||
_ = cmd.RegisterFlagCompletionFunc(storageDriverFlagName, completion.AutocompleteNone) //TODO: what can we recommend here?
|
_ = cmd.RegisterFlagCompletionFunc(storageDriverFlagName, completion.AutocompleteNone) //TODO: what can we recommend here?
|
||||||
|
|
||||||
storageOptFlagName := "storage-opt"
|
|
||||||
pFlags.StringArrayVar(&opts.StorageOpts, storageOptFlagName, []string{}, "Used to pass an option to the storage driver")
|
|
||||||
_ = cmd.RegisterFlagCompletionFunc(storageOptFlagName, completion.AutocompleteNone)
|
|
||||||
|
|
||||||
tmpdirFlagName := "tmpdir"
|
tmpdirFlagName := "tmpdir"
|
||||||
pFlags.StringVar(&opts.Engine.TmpDir, tmpdirFlagName, "", "Path to the tmp directory for libpod state content.\n\nNote: use the environment variable 'TMPDIR' to change the temporary storage location for container images, '/var/tmp'.\n")
|
pFlags.StringVar(&opts.Engine.TmpDir, tmpdirFlagName, "", "Path to the tmp directory for libpod state content.\n\nNote: use the environment variable 'TMPDIR' to change the temporary storage location for container images, '/var/tmp'.\n")
|
||||||
_ = cmd.RegisterFlagCompletionFunc(tmpdirFlagName, completion.AutocompleteDefault)
|
_ = cmd.RegisterFlagCompletionFunc(tmpdirFlagName, completion.AutocompleteDefault)
|
||||||
@ -365,6 +361,10 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
storageOptFlagName := "storage-opt"
|
||||||
|
pFlags.StringArrayVar(&opts.StorageOpts, storageOptFlagName, []string{}, "Used to pass an option to the storage driver")
|
||||||
|
_ = cmd.RegisterFlagCompletionFunc(storageOptFlagName, completion.AutocompleteNone)
|
||||||
|
|
||||||
// Override default --help information of `--help` global flag
|
// Override default --help information of `--help` global flag
|
||||||
var dummyHelp bool
|
var dummyHelp bool
|
||||||
pFlags.BoolVar(&dummyHelp, "help", false, "Help for podman")
|
pFlags.BoolVar(&dummyHelp, "help", false, "Help for podman")
|
||||||
|
@ -420,7 +420,6 @@ func (c *Container) setupStorage(ctx context.Context) error {
|
|||||||
if c.config.Rootfs == "" && (c.config.RootfsImageID == "" || c.config.RootfsImageName == "") {
|
if c.config.Rootfs == "" && (c.config.RootfsImageID == "" || c.config.RootfsImageName == "") {
|
||||||
return errors.Wrapf(define.ErrInvalidArg, "must provide image ID and image name to use an image")
|
return errors.Wrapf(define.ErrInvalidArg, "must provide image ID and image name to use an image")
|
||||||
}
|
}
|
||||||
|
|
||||||
options := storage.ContainerOptions{
|
options := storage.ContainerOptions{
|
||||||
IDMappingOptions: storage.IDMappingOptions{
|
IDMappingOptions: storage.IDMappingOptions{
|
||||||
HostUIDMapping: true,
|
HostUIDMapping: true,
|
||||||
|
@ -22,6 +22,7 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) {
|
|||||||
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Decode()"))
|
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Decode()"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
warn, err := generate.CompleteSpec(r.Context(), runtime, &sg)
|
warn, err := generate.CompleteSpec(r.Context(), runtime, &sg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.InternalServerError(w, err)
|
utils.InternalServerError(w, err)
|
||||||
|
Reference in New Issue
Block a user