summaryrefslogtreecommitdiffstats
path: root/dozentenmodul
diff options
context:
space:
mode:
authorSimon Rettberg2022-11-03 16:16:00 +0100
committerSimon Rettberg2022-11-03 16:16:00 +0100
commit2769b36f998dd23bf2c5c2aa7a5c47f97e67a0e7 (patch)
treec98ec2fe2f2d81eb564cfc1129dcc7944cfad909 /dozentenmodul
parent[client] Fix build; don't depend on implicit apache-commons dep (diff)
downloadtutor-module-2769b36f998dd23bf2c5c2aa7a5c47f97e67a0e7.tar.gz
tutor-module-2769b36f998dd23bf2c5c2aa7a5c47f97e67a0e7.tar.xz
tutor-module-2769b36f998dd23bf2c5c2aa7a5c47f97e67a0e7.zip
[client] Check VM HDD size limit on upload
Older client versions would run into an exception when trying to initiate the actual upload, in which case the user already entered all the meta data for their VM. This is a subpar experience since that work was all for nothing then. Instead, warn the user right away after selecting the VM. This will also show the limit in the top-right corner of the main window.
Diffstat (limited to 'dozentenmodul')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java13
-rw-r--r--dozentenmodul/src/main/properties/i18n/page.properties2
-rw-r--r--dozentenmodul/src/main/properties/i18n/page_de_DE.properties2
4 files changed, 23 insertions, 1 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java
index 4be287d7..8b521c9a 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java
@@ -592,7 +592,12 @@ public abstract class MainWindow {
try {
SatelliteStatus status = ThriftManager.getSatClient().getStatus();
failures = 0;
- remoteString = " [Store: " + FormatHelper.bytes(status.availableStorageBytes, false) + "]";
+ remoteString = " [Store: " + FormatHelper.bytes(status.availableStorageBytes, false);
+ long maxSize = Session.getSatelliteConfig().vmSizeLimit;
+ if (maxSize > 0) {
+ remoteString += ", VM-Limit: " + FormatHelper.bytes(maxSize, false);
+ }
+ remoteString += "]";
if (!timeDiffChecked) {
final long now = System.currentTimeMillis() / 1000;
final long diffSecs = Math.abs(now - status.serverTime);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
index d0b491e3..44ae307f 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
@@ -35,6 +35,7 @@ import org.openslx.dozmod.thrift.ThriftError;
import org.openslx.dozmod.thrift.UploadInitiator;
import org.openslx.dozmod.thrift.WrappedException;
import org.openslx.dozmod.thrift.cache.MetaDataCache;
+import org.openslx.dozmod.util.FormatHelper;
import org.openslx.sat.thrift.version.Feature;
import org.openslx.thrifthelper.TConst;
import org.openslx.virtualization.configuration.VirtualizationConfigurationVmware;
@@ -335,6 +336,18 @@ public class ImageUploadPage extends ImageUploadPageLayout {
return;
}
+ // Check imposed size limit by server
+ long maxSize = Session.getSatelliteConfig().vmSizeLimit;
+ if (maxSize > 0 && maxSize < vmDiskFileInfo.length()) {
+ Gui.showMessageBox(
+ I18n.PAGE.getString("ImageUpload.Message.warning.diskImageTooBig",
+ FormatHelper.bytes(maxSize, false), FormatHelper.bytes(vmDiskFileInfo.length(), false)),
+ MessageType.WARNING, null, null);
+ setErrorMessage(I18n.PAGE.getString("ImageUpload.WizardPage.errorMessage.diskImageTooBig"));
+ setPageComplete(false);
+ return;
+ }
+
// everything seems fine so far
state.diskFile = vmDiskFileInfo;
state.descriptionFile = file;
diff --git a/dozentenmodul/src/main/properties/i18n/page.properties b/dozentenmodul/src/main/properties/i18n/page.properties
index 430af273..21d66102 100644
--- a/dozentenmodul/src/main/properties/i18n/page.properties
+++ b/dozentenmodul/src/main/properties/i18n/page.properties
@@ -46,6 +46,8 @@ ImageUpload.WizardPage.errorMessage.multipleVmxInDirFound=There appear to be mul
of which the first one has been selected. If this does not seem correct\n\
please make sure that only the correct .vmx file is bundled with the\n virtual machine that should be uploaded.
ImageUpload.WizardPage.errorMessage.errorWhileSearchingForVmx=An error occured while trying to search for .vmx files in the directory.
+ImageUpload.Message.warning.diskImageTooBig=Your virtual HDD is too large ({1}). Server limit is {0}.
+ImageUpload.WizardPage.errorMessage.diskImageTooBig=Virtual disk too large.
# ImageOvfConversionPage
ImageOvfConversion.MessageBox.notAVmwareOrVboxImage=The selected file does not appear to be a virtual machine\n\
diff --git a/dozentenmodul/src/main/properties/i18n/page_de_DE.properties b/dozentenmodul/src/main/properties/i18n/page_de_DE.properties
index 350d2e1f..fec5665c 100644
--- a/dozentenmodul/src/main/properties/i18n/page_de_DE.properties
+++ b/dozentenmodul/src/main/properties/i18n/page_de_DE.properties
@@ -46,6 +46,8 @@ ImageUpload.WizardPage.errorMessage.multipleVmxInDirFound=Im ausgewählten .vmwa
Die erste .vmx Datei wurde ausgewählt. Bitte stellen Sie sicher, dass die Korrekte Datei ausgewählt wurde.\n\
Falls dies nicht der Fall ist, stellen Sie bitte sicher, dass sich nur eine .vmx Datei im .vmwarevm Verzeichnis befindet.
ImageUpload.WizardPage.errorMessage.errorWhileSearchingForVmx=Beim Suchen nach einer .vmx Datei im (vmwarevm) Verzeichnis ist ein Fehler aufgetreten!
+ImageUpload.Message.warning.diskImageTooBig=Ihre virtuelle Festplatte ist zu groß ({1}). Das serverseitige Limit sind {0}.
+ImageUpload.WizardPage.errorMessage.diskImageTooBig=Virtuelle Festplatte zu groß.
# ImageOvfConversionPage
ImageOvfConversion.MessageBox.notAVmwareOrVboxImage=Die ausgewählte Datei scheint kein mit VMware oder VirtualBox erstelltes Image zu sein.