From 100d2fdcfd37fafba6f27debe7fee1b4899551e8 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Wed, 5 Feb 2020 10:37:02 -0500 Subject: Special case memory-swap=-1 We document that memory-swap==-1 means unlimited, but currently we won't allow the user to specify the -1 value. Signed-off-by: Daniel J Walsh --- cmd/podman/shared/create.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'cmd/podman') diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go index 2f637694b..010c80373 100644 --- a/cmd/podman/shared/create.go +++ b/cmd/podman/shared/create.go @@ -309,9 +309,13 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod. } } if c.String("memory-swap") != "" { - memorySwap, err = units.RAMInBytes(c.String("memory-swap")) - if err != nil { - return nil, errors.Wrapf(err, "invalid value for memory-swap") + if c.String("memory-swap") == "-1" { + memorySwap = -1 + } else { + memorySwap, err = units.RAMInBytes(c.String("memory-swap")) + if err != nil { + return nil, errors.Wrapf(err, "invalid value for memory-swap") + } } } if c.String("kernel-memory") != "" { -- cgit v1.2.3-54-g00ecf