Skip to content

Commit

Permalink
Fix size to match Docker selection
Browse files Browse the repository at this point in the history
Fixes: containers#13096

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan authored and patrycja-guzik committed Feb 15, 2022
1 parent 33dd38c commit 0f9d7fc
Show file tree
Hide file tree
Showing 14 changed files with 1,107 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/specgenutil/specgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/containers/podman/v4/pkg/specgen"
systemdDefine "github.com/containers/podman/v4/pkg/systemd/define"
"github.com/containers/podman/v4/pkg/util"
"github.com/docker/docker/opts"
"github.com/docker/go-units"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
Expand Down Expand Up @@ -422,11 +423,12 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions

// SHM Size
if c.ShmSize != "" {
shmSize, err := units.FromHumanSize(c.ShmSize)
if err != nil {
var m opts.MemBytes
if err := m.Set(c.ShmSize); err != nil {
return errors.Wrapf(err, "unable to translate --shm-size")
}
s.ShmSize = &shmSize
val := m.Value()
s.ShmSize = &val
}

if c.Net != nil {
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/containers_conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ var _ = Describe("Verify podman containers.conf usage", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("size=200k"))

session = podmanTest.Podman([]string{"run", "--shm-size", "1g", ALPINE, "grep", "shm", "/proc/self/mounts"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("size=1048576k"))
})

It("add capabilities", func() {
Expand Down
84 changes: 84 additions & 0 deletions vendor/github.com/docker/docker/opts/address_pools.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions vendor/github.com/docker/docker/opts/env.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

183 changes: 183 additions & 0 deletions vendor/github.com/docker/docker/opts/hosts.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions vendor/github.com/docker/docker/opts/hosts_unix.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0f9d7fc

Please sign in to comment.