diff options
author | Simon Rettberg | 2019-07-10 17:16:54 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-07-10 17:16:54 +0200 |
commit | 2794fd635816b03d19f19ea620629a2e9f4b38a1 (patch) | |
tree | 58b81141ba20db4a5c07822e6d04e4d087d8af66 /core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc | |
parent | [run-virt/*] Make VIRTCMDOPTS an array for space safeness (diff) | |
download | mltk-2794fd635816b03d19f19ea620629a2e9f4b38a1.tar.gz mltk-2794fd635816b03d19f19ea620629a2e9f4b38a1.tar.xz mltk-2794fd635816b03d19f19ea620629a2e9f4b38a1.zip |
[run-virt] Use slx-tools to determine if /tmp/virt is in RAM
Also avoid triple-negation for the according variable...
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc')
-rw-r--r-- | core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc index c3a5009f..414c654a 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc @@ -31,24 +31,28 @@ set_virt_memory() { EXIT_TYPE="internal" EXIT_REASON="Konnte die Größe des Arbeitsspeichers nicht ermitteln!" cleanexit 1 fi - # Amount of memory for the VM. Be generous if diff is written to HDD + # Calculare amount of memory for the VM. Be generous if diff is written to HDD. + # First, determine how much should be left to the host system. Minimum is 1GB. local min=1024 local reserve max - if notempty TMPDIR_NOT_RAM; then + if $TMPDIR_IN_RAM; then + # tmp in RAM, so reserve a lot for the system since that is where the HDD diff goes. + reserve=65 + max=8192 # But max. 8GB + else + # We have a backing store for the HDD diff, be generous if lsmod | grep -q '^nvidia'; then + # With nvidia cards, the host needs a bit more RAM. max=2800 reserve=28 else max=1800 reserve=21 fi - else - reserve=65 - max=8192 fi # Calculate absulute amount of RAM that should stay available to the host - local reserve="$(( ( HOST_MEM_TOTAL * reserve ) / 100 ))" + reserve="$(( ( HOST_MEM_TOTAL * reserve ) / 100 ))" # Respect some upper and lower bounds for the host amount [ "$reserve" -lt "$min" ] && reserve="$min" [ "$reserve" -gt "$max" ] && reserve="$max" |