diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-05-26 00:51:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-26 00:51:14 -0700 |
commit | e81457dc8e6632f4e9c7a4d240c9a73e8d509bb3 (patch) | |
tree | b257584ab3976344e59c167f65b4acdc00a6fdcc | |
parent | c5b3cba9c31cd7e043deb9ad82e65184f5bdfdb0 (diff) | |
parent | 738a8fe637775e295af72cb55155a36fa366bfd7 (diff) | |
download | podman-e81457dc8e6632f4e9c7a4d240c9a73e8d509bb3.tar.gz podman-e81457dc8e6632f4e9c7a4d240c9a73e8d509bb3.tar.bz2 podman-e81457dc8e6632f4e9c7a4d240c9a73e8d509bb3.zip |
Merge pull request #10430 from sjug/noop_gpu_flag
Add podman run --gpus flag for compatibility
-rw-r--r-- | cmd/podman/containers/run.go | 8 | ||||
-rw-r--r-- | test/e2e/run_device_test.go | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go index 8e27977c0..4bd06a47b 100644 --- a/cmd/podman/containers/run.go +++ b/cmd/podman/containers/run.go @@ -77,6 +77,11 @@ func runFlags(cmd *cobra.Command) { flags.StringVar(&runOpts.DetachKeys, detachKeysFlagName, containerConfig.DetachKeys(), "Override the key sequence for detaching a container. Format is a single character `[a-Z]` or a comma separated sequence of `ctrl-<value>`, where `<value>` is one of: `a-cf`, `@`, `^`, `[`, `\\`, `]`, `^` or `_`") _ = cmd.RegisterFlagCompletionFunc(detachKeysFlagName, common.AutocompleteDetachKeys) + gpuFlagName := "gpus" + flags.String(gpuFlagName, "", "This is a Docker specific option and is a NOOP") + _ = cmd.RegisterFlagCompletionFunc(gpuFlagName, completion.AutocompleteNone) + _ = flags.MarkHidden("gpus") + if registry.IsRemote() { _ = flags.MarkHidden("preserve-fds") _ = flags.MarkHidden("conmon-pidfile") @@ -204,5 +209,8 @@ func run(cmd *cobra.Command, args []string) error { logrus.Errorf("%s", errorhandling.JoinErrors(rmErrors)) } } + if cmd.Flag("gpus").Changed { + logrus.Info("--gpus is a Docker specific option and is a NOOP") + } return nil } diff --git a/test/e2e/run_device_test.go b/test/e2e/run_device_test.go index 3137e3fe4..735e44d3e 100644 --- a/test/e2e/run_device_test.go +++ b/test/e2e/run_device_test.go @@ -113,4 +113,10 @@ var _ = Describe("Podman run device", func() { Expect(session.ExitCode()).To(Equal(0)) Expect(session.OutputToString()).To(Equal("/dev/kmsg1")) }) + + It("podman run --gpus noop", func() { + session := podmanTest.Podman([]string{"run", "--gpus", "all", ALPINE, "ls", "/"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + }) }) |