From 3aebd3516e346a0f5b3c6a08b8c488fff1939e2c Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 27 Apr 2021 12:06:31 +0200 Subject: [vmware-common] Increase OS HW limits, move VMware specific limits --- .../includes/determine_hardware_limitations.inc | 38 +++++++++++----------- .../plugins/vmware/includes/write_final_vmx.inc | 28 ++++++++++++---- 2 files changed, 40 insertions(+), 26 deletions(-) (limited to 'core/modules/vmware-common') diff --git a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/determine_hardware_limitations.inc b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/determine_hardware_limitations.inc index b7c59819..f63a9ba1 100644 --- a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/determine_hardware_limitations.inc +++ b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/determine_hardware_limitations.inc @@ -67,7 +67,7 @@ set_vm_hardware_limits() { ;; winnet*64|win*2003*64|windowsnet*64) VM_OS_TYPE="winnetstandard-64" - MAXMEM="8000" + MAXMEM="16000" MAXCORES="8" ;; winnet*|win*2003*|windowsnet*) @@ -97,18 +97,18 @@ set_vm_hardware_limits() { ;; windows7-64) VM_OS_TYPE="windows7-64" - MAXMEM="32000" + MAXMEM="64000" MAXCORES="8" ;; windows8-64) VM_OS_TYPE="windows8-64" - MAXMEM="32000" - MAXCORES="8" + MAXMEM="128000" + MAXCORES="256" ;; windows9-64) VM_OS_TYPE="windows9-64" - MAXMEM="64000" - MAXCORES="8" + MAXMEM="512000" + MAXCORES="256" ;; winvista) VM_OS_TYPE="winvista" @@ -121,22 +121,20 @@ set_vm_hardware_limits() { MAXCORES="4" ;; windows8) - VM_OS_TYPE="windows8" MAXMEM="8000" - MAXCORES="4" + MAXCORES="32" ;; windows9) - VM_OS_TYPE="windows9" MAXMEM="8000" - MAXCORES="4" + MAXCORES="32" ;; win*64) - MAXMEM="16000" - MAXCORES="4" + MAXMEM="32000" + MAXCORES="32" ;; win*) MAXMEM="8000" - MAXCORES="1" + MAXCORES="32" ;; dos|msdos*|ms-dos*) VM_OS_TYPE="dos" @@ -147,25 +145,24 @@ set_vm_hardware_limits() { macos*64) VM_OS_TYPE="freebsd-64" MAXMEM="4000" - MAXCORES="2" + MAXCORES="8" ;; macos*) VM_OS_TYPE="freebsd" MAXMEM="4000" - MAXCORES="1" + MAXCORES="4" ;; beos*) VM_OS_TYPE="other" SHARED_FOLDERS="FALSE" + MAXCORES="16" ;; # Unknown guestOS setting in .xml - this encompasses linux too, # as there is a multitude of different distributions. Perhaps further # action will be needed if this leads to problems with exotic OSs. *64) - VM_OS_TYPE="other-64" - # SHARED_FOLDERS="FALSE" MAXMEM="123456" - MAXCORES="4" + MAXCORES="64" ;; *) VM_OS_TYPE="other" @@ -177,7 +174,10 @@ set_vm_hardware_limits() { declare -g CPU_CORES="${HW_THREADS:-1}" declare -rg HOST_CORE_COUNT="$CPU_CORES" - [ "$CPU_CORES" -gt "$MAXCORES" ] && CPU_CORES="$MAXCORES" + if (( CPU_CORES > MAXCORES )); then + writelog "Limiting vCPU count from $CPU_CORES to $MAXCORES because of guest OS" + CPU_CORES="$MAXCORES" + fi # It currently makes no sense to set the virtual number of cores # to a different value than the virtual number of cores per virtual CPU. diff --git a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc index 43738718..41f5840e 100644 --- a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc +++ b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc @@ -136,6 +136,20 @@ setup_serial() { # CPU and RAM setup_vcpu_ram() { #writelog "numvcpus = ${CPU_CORES} - maxvcpus=${HOST_CORE_COUNT}" + if (( VM_HW_VERSION < 18 && CPU_CORES > 16 )); then + writelog "Limiting VM to 16 cores since hwVersion < 18" + CPU_CORES=16 + elif (( CPU_CORES > 32 )); then + writelog "Limiting VM to 32 cores since it's the current maximum VMware supports" + CPU_CORES=32 + fi + if (( VM_HW_VERSION < 18 && VM_MEM > 65536 )); then + writelog "Limiting VM to 64GB since hwVersion < 18" + VM_MEM=65536 + elif (( VM_MEM > 131072 )); then + writelog "Limiting VM to 128GB since it's the current maximum VMware supports" + VM_MEM=131072 + fi cat >> "${TMPCONFIG}" <<-HEREEND numvcpus = "$CPU_CORES" cpuid.coresPerSocket = "$VM_CORES_PER_SOCKET" @@ -264,13 +278,6 @@ setup_graphics() { } finalize_hardware() { - # Apply $maxhardwareversion to final VMX - if notempty VM_HW_VERSION && [ "$VM_HW_VERSION" -gt "$maxhardwareversion" ]; then - writelog "Hardware version capped to $maxhardwareversion (was $VM_HW_VERSION)" - sed -i 's/^virtualHW\.version.*$/virtualHW.version = "'$maxhardwareversion'"/I' "${TMPCONFIG}" - VM_HW_VERSION="$maxhardwareversion" - fi - # Enable nested virtualization if not specified in remote vmx if [ -e "/run/hwinfo" ] && ! grep -qi '^vhv\.enable' "${TMPCONFIG}" \ && detect_cpu_flag "ept" "npt" \ @@ -294,6 +301,13 @@ finalize_hardware() { ## MAIN ## write_final_vmx() { + # Apply $maxhardwareversion to final VMX + if notempty VM_HW_VERSION && [ "$VM_HW_VERSION" -gt "$maxhardwareversion" ]; then + writelog "Hardware version capped to $maxhardwareversion (was $VM_HW_VERSION)" + sed -i 's/^virtualHW\.version.*$/virtualHW.version = "'$maxhardwareversion'"/I' "${TMPCONFIG}" + VM_HW_VERSION="$maxhardwareversion" + fi + replace_placeholders setup_ethernet setup_optical_drives -- cgit v1.2.3-55-g7522