From 7c7da8bedabe91fdae8a3d385aa29a8daa52fba2 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Fri, 7 Jan 2022 13:34:15 +0100 Subject: [PATCH] copr-builders: allow using /dev/vdd for swap, too --- .../files/provision/files/enable-swap.sh | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/roles/copr/backend/files/provision/files/enable-swap.sh b/roles/copr/backend/files/provision/files/enable-swap.sh index 4f231be263..b24681476a 100644 --- a/roles/copr/backend/files/provision/files/enable-swap.sh +++ b/roles/copr/backend/files/provision/files/enable-swap.sh @@ -6,14 +6,24 @@ set -e part_suffix=p swap_device= if test -e /dev/xvda1 && test -e /dev/nvme0n1; then + # AWS aarch64 machine. We use separate volume allocation as the default + # root disk in our instance type is too small. swap_device=/dev/nvme0n1 elif test -e /dev/nvme1n1; then - # AWS machine + # AWS x86_64 machine. There's >= 400G space on the default volume in our + # instance type. swap_device=/dev/nvme1n1 -elif test -e /dev/vdb; then - # libvirt machine, and IBM Cloud s390x - swap_device=/dev/vdb - part_suffix= +else + # LibVirt (on-premise) machine, or the IBM Cloud machine. Find the "large" + # volume, that one will be used. + for vol in /dev/vdb /dev/vdd; do + mount | grep $vol && continue + size=$(blockdev --getsize64 "$vol") + test "$size" -le 150000000000 && continue + swap_device=$vol + part_suffix= + break + done fi test -n "$swap_device"