diff options
-rw-r--r-- | remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/parse_vmx.inc | 16 | ||||
-rw-r--r-- | remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include | 7 |
2 files changed, 13 insertions, 10 deletions
diff --git a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/parse_vmx.inc b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/parse_vmx.inc index 73569a19..2b03e153 100644 --- a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/parse_vmx.inc +++ b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/includes/parse_vmx.inc @@ -128,17 +128,27 @@ if [ -n "$SLX_EXAM" ]; then echo 'gui.restricted = "true"' >> "$TMPDIR/$IMGUUID" fi +# Killing duplicate lines (output much nicer than sort -u): +awk '!a[$0]++' "${TMPDIR}/${IMGUUID}" > "${TMPDIR}/${IMGUUID}.tmp" && mv "${TMPDIR}/${IMGUUID}.tmp" "${TMPDIR}/${IMGUUID}" + +# Apply $maxhardwareversion to final VMX +HWVER=$(grep -i -m1 '^virtualHW.version *= *' "${TMPDIR}/${IMGUUID}" | awk -F '=' '{print $2}' | sed -r 's/[^0-9]//g') +if [ -n "$HWVER" ] && [ "$HWVER" -gt "$maxhardwareversion" ]; then + writelog "Hardware version capped to $maxhardwareversion (was $HWVER)" + sed -i 's/^virtualHW\.version.*$/virtualHW.version = "'$maxhardwareversion'"/I' "${TMPDIR}/${IMGUUID}" + HWVER="$maxhardwareversion" +fi + # Enable nested virtualization if not specified in remote vmx if [ -e "/run/hwinfo" ] && ! grep -qi '^vhv\.enable' "${TMPDIR}/${IMGUUID}" \ - && grep -qE '^flags\s*:.*\b(ept|npt)\b' "/proc/cpuinfo"; then + && grep -qE '^flags\s*:.*\b(ept|npt)\b' "/proc/cpuinfo" + && [ "$HWVER" -ge "9" ]; then . "/run/hwinfo" [ "${HW_KVM}" = "ENABLED" ] && echo 'vhv.enable = "TRUE"' >> "${TMPDIR}/${IMGUUID}" fi # TODO: Need a way to check if supported by hardware before enabling! #grep -qi '^vpmc\.enable' "${TMPDIR}/${IMGUUID}" || echo 'vpmc.enable = "TRUE"' >> "${TMPDIR}/${IMGUUID}" -# Killing duplicate lines (output much nicer than sort -u): -awk '!a[$0]++' "${TMPDIR}/${IMGUUID}" > "${TMPDIR}/${IMGUUID}.tmp" && mv "${TMPDIR}/${IMGUUID}.tmp" "${TMPDIR}/${IMGUUID}" # At last_ Let's copy it to $confdir/run-vmware.conf cp -p "$TMPDIR/$IMGUUID" "$conffile" && writelog "Copied TMPDIR/IMGUUID ${TMPDIR}/${IMGUUID} to conffile ${conffile}" || \ diff --git a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include index e25947e0..4d263272 100644 --- a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include +++ b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include @@ -53,13 +53,6 @@ fi # needs writelog() from vmchooser-run_virt source "${VMWAREINCLUDEDIR}/logging.inc" && logging -# Apply $maxhardwareversion to final VMX -HWVER=$(grep -i '^virtualHW.version *= *' "$conffile" | head -n 1 | awk -F '=' '{print $2}' | sed -r 's/[^0-9]//g') -if [ -n "$HWVER" ] && [ "$HWVER" -gt "$maxhardwareversion" ]; then - writelog "Hardware version capped to $maxhardwareversion (was $HWVER)" - sed -i 's/^virtualHW\.version.*$/virtualHW.version = "'$maxhardwareversion'"/I' "$conffile" -fi - # See if there are any USB devices connected that we want to pass through immediately get_usb_devices 'usb.autoConnect.deviceXXXXX = "0x%VENDOR%:0x%PRODUCT%"' \ | sed -r 's/0x0+/0x/g' \ |