From af3499db5a91aa6c09a3ba892a8921a5ece6e5ed Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Fri, 5 Feb 2021 12:50:22 -0500 Subject: Latest crun/runc should handle blkio-weight test Signed-off-by: Daniel J Walsh --- .cirrus.yml | 2 +- test/e2e/run_test.go | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 4e7893e3b..9c13f5303 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -30,7 +30,7 @@ env: PRIOR_UBUNTU_NAME: "ubuntu-2004" # Google-cloud VM Images - IMAGE_SUFFIX: "c6524344056676352" + IMAGE_SUFFIX: "c5961289315909632" FEDORA_CACHE_IMAGE_NAME: "fedora-${IMAGE_SUFFIX}" PRIOR_FEDORA_CACHE_IMAGE_NAME: "prior-fedora-${IMAGE_SUFFIX}" UBUNTU_CACHE_IMAGE_NAME: "ubuntu-${IMAGE_SUFFIX}" diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 490d05699..0ec4edbab 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -583,9 +583,6 @@ USER bin` Skip("Kernel does not support blkio.weight") } } - if podmanTest.Host.Distribution == "ubuntu" { - Skip("Ubuntu <= 20.10 lacks BFQ scheduler") - } if CGROUPSV2 { // convert linearly from [10-1000] to [1-10000] session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.bfq.weight"}) -- cgit v1.2.3-54-g00ecf From 1c873c7da8b5fddf02d512826ab7f728fc0b6111 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 17 Mar 2021 16:38:27 +0100 Subject: test: simplify cgroup path with cgroup v2, the cgroupns is enabled by default. Signed-off-by: Giuseppe Scrivano --- test/e2e/run_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 0ec4edbab..be2fb926f 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -585,7 +585,7 @@ USER bin` } if CGROUPSV2 { // convert linearly from [10-1000] to [1-10000] - session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.bfq.weight"}) + session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/io.bfq.weight"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) Expect(session.OutputToString()).To(ContainSubstring("51")) -- cgit v1.2.3-54-g00ecf From 592aae4f924cfe1f3a3364d5e01a13bd005f8e82 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 17 Mar 2021 16:39:01 +0100 Subject: test: fix test for last crun/runc there was a documentation issue for the kernel that reported the range to be different than on cgroup v1. The issue has been fixed in crun/runc. Adapt the test. Signed-off-by: Giuseppe Scrivano --- test/e2e/run_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index be2fb926f..366ba666c 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -584,11 +584,13 @@ USER bin` } } if CGROUPSV2 { - // convert linearly from [10-1000] to [1-10000] session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/io.bfq.weight"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - Expect(session.OutputToString()).To(ContainSubstring("51")) + // there was a documentation issue in the kernel that reported a different range [1-10000] for the io controller. + // older versions of crun/runc used it. For the time being allow both versions to pass the test. + // FIXME: drop "|51" once all the runtimes we test have the fix in place. + Expect(strings.Replace(session.OutputToString(), "default ", "", 1)).To(MatchRegexp("15|51")) } else { session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.weight"}) session.WaitWithDefaultTimeout() -- cgit v1.2.3-54-g00ecf From 8da5fd820955884fc61159e09b776cfec37f417a Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 17 Mar 2021 21:29:49 +0100 Subject: test: check for io.stat existence on cgroup v2 Signed-off-by: Giuseppe Scrivano --- test/e2e/run_test.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 366ba666c..4e5106731 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -576,14 +576,12 @@ USER bin` }) It("podman run blkio-weight test", func() { - SkipIfRootless("FIXME: This is blowing up because of no /sys/fs/cgroup/user.slice/user-14467.slice/user@14467.service/cgroup.subtree_control file") SkipIfRootlessCgroupsV1("Setting blkio-weight not supported on cgroupv1 for rootless users") - if !CGROUPSV2 { - if _, err := os.Stat("/sys/fs/cgroup/blkio/blkio.weight"); os.IsNotExist(err) { - Skip("Kernel does not support blkio.weight") - } - } + SkipIfRootless("By default systemd doesn't delegate io to rootless users") if CGROUPSV2 { + if _, err := os.Stat("/sys/fs/cgroup/io.stat"); os.IsNotExist(err) { + Skip("Kernel does not have io.stat") + } session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/io.bfq.weight"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -592,6 +590,9 @@ USER bin` // FIXME: drop "|51" once all the runtimes we test have the fix in place. Expect(strings.Replace(session.OutputToString(), "default ", "", 1)).To(MatchRegexp("15|51")) } else { + if _, err := os.Stat("/sys/fs/cgroup/blkio/blkio.weight"); os.IsNotExist(err) { + Skip("Kernel does not support blkio.weight") + } session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.weight"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) -- cgit v1.2.3-54-g00ecf