]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
windows: limit number of Linux VM vcpus 2228/head
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Mon, 22 Apr 2024 12:19:18 +0000 (15:19 +0300)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Mon, 22 Apr 2024 12:21:20 +0000 (15:21 +0300)
We reduced the amount of memory allocated to Linux VMs used by the
Windows PR jobs to 16GB but we're now hitting OOM errors while
building Ceph.

To mitigate this, we'll limit the number of parallel jobs and
allocated vcpus.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
scripts/ceph-windows/setup_libvirt_ubuntu_vm

index 6de1d76d09653f44d2eff18c8ef0d06c9243d455..b2481ab8ce502e49593feb4bd5e5e8ddc0f7a2da 100644 (file)
@@ -4,9 +4,14 @@ set -o pipefail
 
 if [[ -z $LIBVIRT_DIR ]]; then echo "ERROR: The env variable LIBVIRT_DIR is not set"; exit 1; fi
 
+nproc=$(nproc)
+# By limiting the number of parallel build jobs, we avoid using excessive
+# amounts of memory.
+DEFAULT_UBUNTU_VM_VCPUS=$((nproc > 16 ? 16 : nproc))
+
 export UBUNTU_VM_IMAGE_URL=${UBUNTU_VM_IMAGE_URL:-"https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img"}
 export UBUNTU_VM_NAME=${UBUNTU_VM_NAME:-"ceph-ubuntu-vstart-${JOB_NAME}-${BUILD_ID}"}
-export UBUNTU_VM_VCPUS="$(nproc)"  # use all the CPU cores avaiable on the host
+export UBUNTU_VM_VCPUS=${UBUNTU_VM_VCPUS:-$DEFAULT_UBUNTU_VM_VCPUS}
 export UBUNTU_VM_MEMORY=${UBUNTU_VM_MEMORY:-"16384"}  # 16 GB
 export UBUNTU_SSH_USER="ubuntu"