Fix Memory Swappiness passing in Container Clone

`DefineCreateFlags` was excluding clone from using the memory-swappiness flag leading the value to be zero
when our deafult is -1. Rearrange the if/else to give clone these memory related options

resolves #13856

Signed-off-by: cdoern <cdoern@redhat.com>
This commit is contained in:
cdoern
2022-04-13 18:38:02 -04:00
committed by cdoern
parent 9822c46981
commit f38b03d375
4 changed files with 75 additions and 48 deletions

View File

@@ -146,6 +146,20 @@ var _ = Describe("Podman container clone", func() {
cloneData = cloneInspect.InspectContainerToJSON()
Expect(createData[0].HostConfig.NanoCpus).ToNot(Equal(cloneData[0].HostConfig.NanoCpus))
Expect(cloneData[0].HostConfig.NanoCpus).To(Equal(nanoCPUs))
create = podmanTest.Podman([]string{"create", ALPINE})
create.WaitWithDefaultTimeout()
Expect(create).To(Exit(0))
clone = podmanTest.Podman([]string{"container", "clone", "--cpus=4", create.OutputToString()})
clone.WaitWithDefaultTimeout()
Expect(clone).To(Exit(0))
cloneInspect = podmanTest.Podman([]string{"inspect", clone.OutputToString()})
cloneInspect.WaitWithDefaultTimeout()
Expect(cloneInspect).To(Exit(0))
cloneData = cloneInspect.InspectContainerToJSON()
Expect(cloneData[0].HostConfig.MemorySwappiness).To(Equal(int64(0)))
})
It("podman container clone in a pod", func() {