From 57bed0e2242eeb9359ddc97009af4e9c2364d442 Mon Sep 17 00:00:00 2001 From: thaibault Date: Thu, 8 Aug 2013 16:24:35 +0200 Subject: Add persistent bootable virtual machine features. --- .../data/opt/openslx/etc/vmware/run-virt.include | 28 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) mode change 100644 => 100755 remote/modules/vmplayer/data/opt/openslx/etc/vmware/run-virt.include (limited to 'remote/modules/vmplayer/data') diff --git a/remote/modules/vmplayer/data/opt/openslx/etc/vmware/run-virt.include b/remote/modules/vmplayer/data/opt/openslx/etc/vmware/run-virt.include old mode 100644 new mode 100755 index 675835a9..9a817d65 --- a/remote/modules/vmplayer/data/opt/openslx/etc/vmware/run-virt.include +++ b/remote/modules/vmplayer/data/opt/openslx/etc/vmware/run-virt.include @@ -230,7 +230,9 @@ MemTrimRate = "-1" # ide-disks ide0:0.present = "$ide" ide0:0.fileName = "$diskfile" -ide0:0.mode = "independent-nonpersistent" +## Edited for persistent mode. +ide0:0.mode = "independent-${diskmode}" +## ide1:0.present = "$cdrom0" ide1:0.autodetect = "TRUE" ide1:0.fileName = "auto detect" @@ -245,7 +247,9 @@ scsi0.present = "$scsi" scsi0:0.present = "$scsi" scsi0:0.fileName = "$diskfile" scsi0.virtualDev = "$hddrv" -scsi0:0.mode = "independent-nonpersistent" +## Edited for persistent mode. +scsi0:0.mode = "independent-${diskmode}"$stateFileConfiguration +## # floppies floppy0.present = "$floppy0" @@ -459,7 +463,7 @@ esac # check for whitelisted HW-3D . /opt/openslx/config -local FORCE3D="" +FORCE3D="" if [ -n "$SLX_VMWARE_3D" ]; then FORCE3D='mks.gl.allowBlacklistedDrivers = "TRUE"' fi @@ -512,6 +516,20 @@ esac # check if ide/scsi and hwver of image # read only the first 30 lines to be sure imghead=$(head -n 30 "${diskfile}") +## Added to handle persistent snapshots. +if [[ "$originalVMDKFilePath" ]]; then + echo "Select \"${originalVMDKFilePath}\" as information base for \"${diskfile}\"." + imghead=$(head -n 30 "$originalVMDKFilePath") && \ + # Support suspend mode. + stateFilePath="$(readlink -f "$(dirname "$diskfile")/"*.vmss)" && \ + if [ -f "$stateFilePath" ]; then + echo "Found state file \"$stateFilePath\"." && \ + stateFileConfiguration=" +checkpoint.vmState = \"$stateFilePath\"" + fi + POSTRUN="stateFilePath=\"\$(readlink --canonicalize \"${confdir}/\"*.vmss)\" && memoryFilePath=\"\$(readlink --canonicalize \"${confdir}/\"*.vmem)\" && [ -f \"\$stateFilePath\" ] && echo \"Saving state and memory file \\\"\$stateFilePath\\\" and \\\"\$memoryFilePath\\\".\" && mv --force \"\$stateFilePath\" \"$(dirname "$diskfile")/\" && mv --force \"\$memoryFilePath\" \"$(dirname "$diskfile")/\"" +fi +## hddrv=$(echo "${imghead}" | grep -m1 -ia "ddb.adapterType" | awk -F '"' '{print $2}') hwver=$(echo "${imghead}" | grep -m1 -ia "ddb.virtualHWVersion" | awk -F '"' '{print $2}') case "${hddrv}" in @@ -557,7 +575,9 @@ cp "/opt/openslx/etc/vmware/nvram" "$confdir/nvram" 2>/dev/null # log script information writelog "# File created by $0 (VMversion ${vmversion})\n# on $(date)\n" -writelog "Starting with non-persistent mode ...\n" +## Edited for persistent mode. +writelog "Starting with ${diskmode} mode ...\n" +## # write all results to logfile # log disksetup -- cgit v1.2.3-55-g7522