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 <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2020-02-05 10:37:02 -05:00
parent 537352cc3e
commit 100d2fdcfd

View File

@ -309,9 +309,13 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
} }
} }
if c.String("memory-swap") != "" { if c.String("memory-swap") != "" {
memorySwap, err = units.RAMInBytes(c.String("memory-swap")) if c.String("memory-swap") == "-1" {
if err != nil { memorySwap = -1
return nil, errors.Wrapf(err, "invalid value for memory-swap") } 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") != "" { if c.String("kernel-memory") != "" {