Skip to content

Commit 6bf571e

Browse files
committed
e2e: add balloons 8-socket 4k-cpu test
Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
1 parent ab07ff5 commit 6bf571e

File tree

3 files changed

+106
-0
lines changed

3 files changed

+106
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
config:
2+
pinCPU: true
3+
pinMemory: false
4+
balloonTypes:
5+
- name: pkg0
6+
minCPUs: 1
7+
maxCPUs: 1
8+
preferCloseToDevices:
9+
- /sys/devices/system/node/node0
10+
shareIdleCPUsInSame: package
11+
12+
- name: pkg2
13+
minCPUs: 1
14+
maxCPUs: 1
15+
preferCloseToDevices:
16+
- /sys/devices/system/node/node2
17+
18+
- name: pkg7
19+
minCPUs: 1
20+
maxCPUs: 1
21+
minBalloons: 1
22+
preferCloseToDevices:
23+
- /sys/devices/system/node/node7
24+
25+
availableResources:
26+
cpu: cpuset:0-4095
27+
reservedResources:
28+
cpu: "cpuset:1"
29+
30+
instrumentation:
31+
httpEndpoint: ":8891"
32+
log:
33+
debug:
34+
- nri-resource-policy
35+
- resource-manager
36+
- cache
37+
- policy
38+
- nri-plugin
39+
- sysfs
40+
source: true
41+
klog:
42+
skip_headers: true
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Prepare virtual machine before installing balloons.
2+
min_kernel_version=6.14
3+
vm-command "uname -r"
4+
if [ "$( ( echo $min_kernel_version; echo $COMMAND_OUTPUT ) | sort --version-sort | tail -n 1 )" == "$min_kernel_version" ]; then
5+
error "quest OS runs too old kernel, hot-plugged CPU node topology may not work. Required: $min_kernel_version"
6+
fi
7+
8+
# Hot-plug CPUs.
9+
vm-command 'grep 511,1535,4095 /sys/devices/system/cpu/enabled' || {
10+
vm-cpu-hotplug 0 511 0
11+
vm-cpu-hotplug 2 511 0
12+
vm-cpu-hotplug 7 511 0
13+
14+
# Wait for the kernel to expose all hot-plugged CPUs in sysfs.
15+
vm-run-until '[ -d /sys/devices/system/cpu/cpu511 ] && [ -d /sys/devices/system/cpu/cpu1535 ] && [ -d /sys/devices/system/cpu/cpu4095 ]'
16+
17+
# Online all CPUs.
18+
vm-command 'for cpuX in /sys/devices/system/cpu/cpu[1-9]*; do
19+
echo onlining $cpuX
20+
( echo 1 > $cpuX/online && echo Successful: write 1 to $cpuX/online ) || echo Failed: write 1 to $cpuX/online
21+
done
22+
grep . /sys/devices/system/cpu/cpu[1-9]*/online'
23+
24+
# Restart kubelet to let it detect new enabled CPUs.
25+
vm-command "systemctl restart kubelet"
26+
}
27+
28+
# Wait until kubelet has reported all enabled CPUs in node capacity.
29+
vm-run-until 'kubectl get node -o jsonpath="{.items[0].status.capacity.cpu}" | grep 6' ||
30+
command-error "Unexpected node CPU capacity"
31+
32+
# Make sure that k8s root cpuset.cpus contains hot-plugged CPUs.
33+
# containerd: kubepods/cpuset.cpus
34+
# cri-o: kubepods.slice/cpuset.cpus
35+
vm-command "grep . /sys/fs/cgroup/kubepods*/cpuset.cpus"
36+
if ! ( grep -q 511 <<< $COMMAND_OUTPUT &&
37+
grep -q 1535 <<< $COMMAND_OUTPUT &&
38+
grep -q 4095 <<< $COMMAND_OUTPUT ); then
39+
command-error "kubepods cpuset.cpus does not include expected CPUs"
40+
fi
41+
42+
# Install balloons
43+
helm-terminate
44+
helm_config=$TEST_DIR/balloons-sparse-4kcpus.cfg helm-launch balloons
45+
46+
# Verify NRT
47+
nrt-verify-zone-resource "reserved[0]" "cpu" "capacity" "6"
48+
nrt-verify-zone-resource "reserved[0]" "cpu" "allocatable" "5"
49+
nrt-verify-zone-resource "pkg7[0]" "cpu" "capacity" "6"
50+
nrt-verify-zone-resource "pkg7[0]" "cpu" "allocatable" "1"
51+
nrt-verify-zone-attribute "pkg7[0]" "cpuset" "4095"
52+
53+
CPUREQ="500m" CPULIM="" MEMREQ=50M MEMLIM=""
54+
ANN0="balloon.balloons.resource-policy.nri.io/container.pod0c0: pkg0"
55+
ANN1="balloon.balloons.resource-policy.nri.io/container.pod0c1: pkg2"
56+
ANN2="balloon.balloons.resource-policy.nri.io/container.pod0c2: pkg7"
57+
CONTCOUNT=3 create besteffort
58+
report allowed
59+
verify 'cpus["pod0c0"] == {"cpu0511","cpu0002","cpu0000"}' \
60+
'cpus["pod0c1"] == {"cpu1535"}' \
61+
'cpus["pod0c2"] == {"cpu4095"}'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
{"mem": "2G", "threads": 1, "cores": 512, "packages": 8, "cpus-present":3}
3+
]

0 commit comments

Comments
 (0)