Skip to content

Commit

Permalink
test: ensure hugepages allocated
Browse files Browse the repository at this point in the history
When deploying a kind cluster, ensure we allocate the requested hugepages.

Signed-off-by: Tiago Castro <[email protected]>
  • Loading branch information
tiagolobocastro committed Jan 10, 2025
1 parent 37218a0 commit be41609
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/k8s-ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: K8s CI
on:
workflow_call:
push:
branches:
- pytest

jobs:
k8s-ci:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-8-cores
steps:
- name: Bind mount /dev/sda1 to /nix
run: |
Expand Down Expand Up @@ -50,7 +53,7 @@ jobs:
nix-shell ./scripts/k8s/shell.nix --run "kubectl -n mayastor logs -l app=upgrade --all-containers=true"
k8s-ci-vm:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-8-cores
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v11
Expand Down
10 changes: 8 additions & 2 deletions scripts/k8s/setup-io-prereq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ die() {
}

setup_hugepages() {
$SYSCTL -w vm.nr_hugepages="$1"
local wanted="$1"
$SYSCTL -w vm.nr_hugepages="$wanted"
local actual
actual=$($SYSCTL -b vm.nr_hugepages)
if [ "$actual" != "$wanted" ]; then
die "Wanted $wanted hugepages, but only allocated $actual hugepages"
fi
}

modprobe_nvme_tcp() {
Expand Down Expand Up @@ -99,7 +105,7 @@ while [ "$#" -gt 0 ]; do
done

if [ -n "$HUGE_PAGES" ]; then
pages=$(sysctl -b vm.nr_hugepages)
pages=$($SYSCTL -b vm.nr_hugepages)

if [ "$HUGE_PAGES" -gt "$pages" ]; then
setup_hugepages "$HUGE_PAGES"
Expand Down

0 comments on commit be41609

Please sign in to comment.