summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-05-10 14:26:05 +0000
committerLars Wirzenius <liw@liw.fi>2020-05-10 14:26:05 +0000
commitf24c72538183736f63c9f5ca94f1d9045115bd07 (patch)
treec7d3af2bc94f649f20aba3f46298bcb67fb0ded1
parent5162bbdc3244794855adadd8d5ad0205000be8c8 (diff)
parent3c306b3bffe6ce680f9bf5b0602fead43a9187e7 (diff)
downloadick-contractor-f24c72538183736f63c9f5ca94f1d9045115bd07.tar.gz
Merge branch 'mem' into 'master'
feat: use all the memory on the manager for the worker, sans 2GB Closes #16 See merge request larswirzenius/contractor!17
-rwxr-xr-xcontractor9
1 files changed, 8 insertions, 1 deletions
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 \