summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 \