From 3c306b3bffe6ce680f9bf5b0602fead43a9187e7 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 10 May 2020 17:24:36 +0300 Subject: feat: use all the memory on the manager for the worker, sans 2GB --- contractor | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/contractor b/contractor index 179f3bf..d5ef494 100755 --- a/contractor +++ b/contractor @@ -329,11 +329,18 @@ class CreateWorkerVM(RemoteExecution): """ n="$(grep -c '^processor' /proc/cpuinfo)" n="$(expr "$n" - 1)" +mem="$(awk '/MemTotal/ {{ print $2 }}' /proc/meminfo)" +smaller="$(expr "$mem" - 2097152)" +if [ "$smaller" -lt 0 ] +then + smaller="$mem" +fi +mem="$(expr "$smaller" / 1024)" virt-install \ --connect=qemu:///system \ --quiet \ --name=worker \ - --memory=4096 \ + --memory="$mem" \ --vcpus="$n" \ --cpu=host \ --import \ -- cgit v1.2.1