summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java23
1 files changed, 21 insertions, 2 deletions
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 87555a4a..16ca257e 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
@@ -23,16 +23,20 @@ import org.openslx.dozmod.gui.helper.QFileChooser;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.layout.ImageUploadPageLayout;
import org.openslx.dozmod.state.UploadWizardState;
+import org.openslx.dozmod.thrift.Session;
import org.openslx.dozmod.thrift.ThriftActions;
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.sat.thrift.version.Feature;
import org.openslx.thrifthelper.TConst;
import org.openslx.util.vm.DiskImage;
import org.openslx.util.vm.DiskImage.UnknownImageFormatException;
+import org.openslx.util.vm.UnsupportedVirtualizerFormatException;
import org.openslx.util.vm.VmMetaData;
import org.openslx.util.vm.VmMetaData.HardDisk;
+import org.openslx.util.vm.VmwareMetaData;
/**
* Page for uploading a new image.
@@ -82,7 +86,13 @@ public class ImageUploadPage extends ImageUploadPageLayout {
browseForVm();
}
});
- allSupportedFilter = new FileNameExtensionFilter("All Supported", "vmx", "vbox");
+ // initialize allSupportedFilter depending on whether multiple hypervisors
+ // are supported or not
+ if (Session.hasFeature(Feature.MULTIPLE_HYPERVISORS)) {
+ allSupportedFilter = new FileNameExtensionFilter("All Supported", "vmx", "vbox");
+ } else {
+ allSupportedFilter = new FileNameExtensionFilter("All Supported", "vmx");
+ }
btnBrowseForImage.requestFocus();
}
@@ -90,7 +100,9 @@ public class ImageUploadPage extends ImageUploadPageLayout {
QFileChooser fc = new QFileChooser(Config.getUploadPath(), false);
fc.setAcceptAllFileFilterUsed(false);
fc.addChoosableFileFilter(vmxFilter);
- fc.addChoosableFileFilter(vboxFilter);
+ if (Session.hasFeature(Feature.MULTIPLE_HYPERVISORS)) {
+ fc.addChoosableFileFilter(vboxFilter);
+ }
fc.addChoosableFileFilter(allSupportedFilter);
fc.setFileFilter(allSupportedFilter);
// differentiate between existing and new VMs
@@ -131,6 +143,13 @@ public class ImageUploadPage extends ImageUploadPageLayout {
}
final String fileformat = state.meta.getVirtualizer().virtName;
+ // bail if multiple hypervisors are not supported
+ if (!(state.meta instanceof VmwareMetaData) && !Session.hasFeature(Feature.MULTIPLE_HYPERVISORS)) {
+ setErrorMessage("Der Hypervisor der gewählten VM (" + fileformat
+ + ") wird vom aktuellen Satellitenserver nicht unterstützt.");
+ setPageComplete(false);
+ return;
+ }
// check if the user somehow changed the type of the VM
if (existingImage != null && !existingImage.virtId.equals(state.meta.getVirtualizer().virtId)) {
Virtualizer existingImageVirtualizer = MetaDataCache.getVirtualizerById(existingImage.virtId);