From ff7985e391379336a9b9821307c267559ac12075 Mon Sep 17 00:00:00 2001 From: "Anderson, Craig (ca846m)" Date: Thu, 3 Jan 2019 14:12:30 -0800 Subject: [PATCH] Parameterize hugepage pod cgroup Change-Id: I5a52397185610e19ce5861ce3c3b3303006a296b --- libvirt/templates/bin/_libvirt.sh.tpl | 5 ++++- libvirt/values.yaml | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libvirt/templates/bin/_libvirt.sh.tpl b/libvirt/templates/bin/_libvirt.sh.tpl index 8c31c03cb..f2b933895 100644 --- a/libvirt/templates/bin/_libvirt.sh.tpl +++ b/libvirt/templates/bin/_libvirt.sh.tpl @@ -64,7 +64,10 @@ if [ 0"$hp_count" -gt 0 ]; then # hugepage byte limit quota to zero out. This workaround sets that pod limit # back to the total number of hugepage bytes available to the baremetal host. if [ -d /sys/fs/cgroup/hugetlb ]; then - for limit in $(ls /sys/fs/cgroup/hugetlb/kubepods/hugetlb.*.limit_in_bytes); do + limits="$(ls /sys/fs/cgroup/hugetlb/{{ .Values.conf.kubernetes.cgroup }}/hugetlb.*.limit_in_bytes)" || \ + (echo "ERROR: Failed to locate any hugetable limits. Did you set the correct cgroup in your values used for this chart?" + exit 1) + for limit in $limits; do target="/sys/fs/cgroup/hugetlb/$(dirname $(awk -F: '($2~/hugetlb/){print $3}' /proc/self/cgroup))/$(basename $limit)" # Ensure the write target for the hugepage limit for the pod exists if [ ! -f "$target" ]; then diff --git a/libvirt/values.yaml b/libvirt/values.yaml index 1a11193e1..a2cde5ba0 100644 --- a/libvirt/values.yaml +++ b/libvirt/values.yaml @@ -87,6 +87,8 @@ conf: stdio_handler: "file" user: "nova" group: "kvm" + kubernetes: + cgroup: "kubepods" pod: affinity: