From 556a8d793040f97927e1ea177ca92d1402ce8250 Mon Sep 17 00:00:00 2001 From: hetong07 Date: Thu, 18 Feb 2021 16:43:19 -0800 Subject: [PATCH] Move the user facing warning inside hasMemoryCgroup(). --- pkg/drivers/kic/oci/oci.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/drivers/kic/oci/oci.go b/pkg/drivers/kic/oci/oci.go index cbf3188ea6..4fa94113b9 100644 --- a/pkg/drivers/kic/oci/oci.go +++ b/pkg/drivers/kic/oci/oci.go @@ -116,6 +116,7 @@ func hasMemoryCgroup() bool { } if _, err := os.Stat(memory); os.IsNotExist(err) { klog.Warning("Your kernel does not support memory limit capabilities or the cgroup is not mounted.") + out.WarningT("Cgroup v2 does not allow setting memory, if you want to set memory, please modify your Grub as instructed in https://docs.docker.com/engine/install/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities") memcg = false } } @@ -186,10 +187,6 @@ func CreateContainerNode(p CreateParams) error { memcgSwap := hasMemorySwapCgroup() memcg := hasMemoryCgroup() - if !memcgSwap || !memcg { - out.WarningT("Cgroup v2 does not allow setting memory, if you want to set memory, please modify your Grub as instructed in https://docs.docker.com/engine/install/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities") - } - // https://www.freedesktop.org/wiki/Software/systemd/ContainerInterface/ var virtualization string if p.OCIBinary == Podman { // enable execing in /var