diff options
author | Jonathan Bauer | 2015-09-08 14:42:37 +0200 |
---|---|---|
committer | Jonathan Bauer | 2015-09-08 14:42:37 +0200 |
commit | aa833251dae7f0df3e0bdd2327494904ff72c7fd (patch) | |
tree | 912ea30a890e84dc7c6a8a027c9321d5cd2556dc /dozentenmodul/src/main/java/org/openslx/dozmod/util | |
parent | [client] Clean up update checker, handle NPEs, close streams (diff) | |
download | tutor-module-aa833251dae7f0df3e0bdd2327494904ff72c7fd.tar.gz tutor-module-aa833251dae7f0df3e0bdd2327494904ff72c7fd.tar.xz tutor-module-aa833251dae7f0df3e0bdd2327494904ff72c7fd.zip |
[client] evaluate max memory of OS when generating vmx
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/util')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/util/VmWrapper.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/VmWrapper.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/VmWrapper.java index fc1623fc..acf6fd3a 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/VmWrapper.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/VmWrapper.java @@ -43,6 +43,7 @@ public class VmWrapper { } // The guestOS should be in the vmx, but the user could have changed it by editing // the image via the GUI. Those changes are not written back to the stored vmx + int osMaxMemMb = 0; if (virtualizerId != null && osId != 0) { OperatingSystem os = MetaDataCache.getOsById(osId); if (os != null && os.virtualizerOsId != null) { @@ -50,14 +51,18 @@ public class VmWrapper { if (virtOsId != null) { vmwareConfig.setOs(virtOsId); } + if (os.maxMemMb > 0) { + osMaxMemMb = os.maxMemMb; + } } } vmwareConfig.addDisplayName(imageName); int mem = getMainMemoryMb() / 2; if (mem < 1024) { mem = 1024; - } else if (mem > 4096) { - mem = 4096; + } + if (osMaxMemMb > 0 && mem > osMaxMemMb) { + mem = osMaxMemMb; } vmwareConfig.addRam(mem); // Output vmx |