Add Compat API for Update

The Docker endpoint here is kind of a nightmare - accepts a full
Resources block, including a large number of scary things like
devices. But it only documents (and seems to use) a small subset
of those. This implements support for that subset. We can always
extend things to implement more later if we have a need.

Signed-off-by: Matt Heon <mheon@redhat.com>
This commit is contained in:
Matt Heon
2024-04-10 13:14:41 -04:00
parent be3f075402
commit ddea30e40e
4 changed files with 156 additions and 1 deletions

View File

@@ -730,6 +730,12 @@ if root; then
eid=$(jq -r '.Id' <<<"$output")
t POST exec/$eid/start 200 $cpu_weight_expect
# Now use the compat API
echo '{ "Memory": 536870912 }' >${TMPD}/compatupdate.json
t POST containers/updateCtr/update ${TMPD}/compatupdate.json 200
t GET libpod/containers/updateCtr/json 200 \
.HostConfig.Memory=536870912
podman rm -f updateCtr
fi

View File

@@ -284,7 +284,7 @@ var _ = Describe("Podman update", func() {
Expect(inspect4.OutputToString()).To(Equal("536870912"))
exec4 := podmanTest.Podman([]string{"exec", testCtr, "cat", "/sys/fs/cgroup/memory.max"})
exec3.WaitWithDefaultTimeout()
exec4.WaitWithDefaultTimeout()
Expect(exec4).Should(ExitCleanly())
Expect(exec4.OutputToString()).Should(ContainSubstring("536870912"))
})