From 95de3a58adc5489163beca49d06c1aee6ca5ce26 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 26 Apr 2023 14:53:42 +0200 Subject: [client] Check if virt config is valid, warn user if not ....but allow to continue anyways --- .../org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java | 12 ++++++++++++ dozentenmodul/src/main/properties/i18n/page.properties | 3 ++- dozentenmodul/src/main/properties/i18n/page_de_DE.properties | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'dozentenmodul') 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 8e033f2f..aacb0d31 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 @@ -47,6 +47,7 @@ import org.openslx.virtualization.disk.DiskImageException; import org.openslx.virtualization.disk.DiskImage.ImageFormat; import org.openslx.virtualization.configuration.VirtualizationConfiguration; import org.openslx.virtualization.configuration.VirtualizationConfiguration.HardDisk; +import org.openslx.virtualization.configuration.VirtualizationConfigurationException; import org.openslx.virtualization.configuration.VirtualizationConfigurationQemu; import org.openslx.virtualization.configuration.VirtualizationConfigurationVirtualBox; @@ -229,6 +230,17 @@ public class ImageUploadPage extends ImageUploadPageLayout { return; } + // See if the config is declared valid + try { + state.virtualizationConfig.validate(); + } catch (VirtualizationConfigurationException e1) { + boolean choice = Gui.showMessageBox(this, + I18n.PAGE.getString("ImageUpload.Message.warning.virtConfigNotValid"), + MessageType.WARNING_RETRY, LOGGER, e1); + if (!choice) + return; + } + try { // transforms (filters) the virtualization configuration final ConfigurationLogicDozModClientToDozModServer uploadLogic = new ConfigurationLogicDozModClientToDozModServer(); diff --git a/dozentenmodul/src/main/properties/i18n/page.properties b/dozentenmodul/src/main/properties/i18n/page.properties index 21d66102..03c29cea 100644 --- a/dozentenmodul/src/main/properties/i18n/page.properties +++ b/dozentenmodul/src/main/properties/i18n/page.properties @@ -19,6 +19,7 @@ ImageUpload.WizardPage.errorMessage.diskImageHasUnknownFormat=''{0}'' has unknow ImageUpload.WizardPage.errorMessage.diskImageSnapshot=The selected VM is in snapshot state. ImageUpload.Message.warning.diskImageNotSupportedByHypervisor=The format of the virtual hard disk associated \ with this\n VM is not supported by the current hypervisor. +ImageUpload.Message.warning.virtConfigNotValid=This seems to be an invalid config file for the given virtualizer. Do you still want to continue? ImageUpload.WizardPage.errorMessage.diskImageNotSupportedByHypervisor=The disk image file format of the VM is not supported by the current hypervisor ImageUpload.Message.warning.diskImageSnapshot=A snapshot was taken of the selected VM. \ In this state\n the VM unfortunately cannot be loaded into the {0} system. Please consolidate\n\ @@ -120,4 +121,4 @@ LectureLocationSelection.WizardPage.errorMessage.tooManyLocations=Too many rooms # LectureOptionsPage LectureOptions.WizardPage.description=Click on ''Next'' to set permissions \ - or ''Finish''. \ No newline at end of file + or ''Finish''. diff --git a/dozentenmodul/src/main/properties/i18n/page_de_DE.properties b/dozentenmodul/src/main/properties/i18n/page_de_DE.properties index fec5665c..5fa49955 100644 --- a/dozentenmodul/src/main/properties/i18n/page_de_DE.properties +++ b/dozentenmodul/src/main/properties/i18n/page_de_DE.properties @@ -27,6 +27,7 @@ ImageUpload.WizardPage.errorMessage.diskImageNotSupportedByHypervisor=Das Format ImageUpload.WizardPage.errorMessage.diskImageStandalone=Die virtuelle Festplatte der VM hat ein inkompatibles Format ImageUpload.Message.warning.diskImageStandalone=Die zu dieser VM gehörige virtuelle Festplatte weist kein \ eigenständiges\nFormat auf. Bitte konvertieren Sie die VM in ein eigenständiges\n (Einzeldatei-) Format. +ImageUpload.Message.warning.virtConfigNotValid=Die ausgewählte Konfigurationsdatei scheint Fehler zu enthalten. Trotzdem fortfahren? ImageUpload.WizardPage.description=Sie können jetzt den Upload starten. ImageUpload.Message.yesNo.cancelLockFile=Die gewählte VM scheint noch in Verwendung zu sein. Bitte fahren Sie die VM\n\ vor dem Hochladen herunter und schließen Sie den VMware Player, ansonsten\n\ -- cgit v1.2.3-55-g7522