summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/util/vm/VmMetaData.java
diff options
context:
space:
mode:
authorralph isenmann2021-02-10 14:36:37 +0100
committerralph isenmann2021-02-10 14:36:37 +0100
commit2fb16ce4a3b41045392d926fcf9d33906108c3cf (patch)
treee7f8fb136854f207b45c1c85f213f4aef5241394 /src/main/java/org/openslx/util/vm/VmMetaData.java
parentRemove unused code and classes (diff)
downloadmaster-sync-shared-2fb16ce4a3b41045392d926fcf9d33906108c3cf.tar.gz
master-sync-shared-2fb16ce4a3b41045392d926fcf9d33906108c3cf.tar.xz
master-sync-shared-2fb16ce4a3b41045392d926fcf9d33906108c3cf.zip
[docker] Check recieved content.
Add a simple check to prevent any content as acceptable
Diffstat (limited to 'src/main/java/org/openslx/util/vm/VmMetaData.java')
-rw-r--r--src/main/java/org/openslx/util/vm/VmMetaData.java21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/main/java/org/openslx/util/vm/VmMetaData.java b/src/main/java/org/openslx/util/vm/VmMetaData.java
index c836697..dca9e27 100644
--- a/src/main/java/org/openslx/util/vm/VmMetaData.java
+++ b/src/main/java/org/openslx/util/vm/VmMetaData.java
@@ -105,16 +105,16 @@ public abstract class VmMetaData<T, U, V, W, X>
this.displayName = dName;
}
}
-
+
public static enum UsbSpeed
{
NONE( "None" ),
USB1_1( "USB 1.1" ),
USB2_0( "USB 2.0" ),
USB3_0( "USB 3.0" );
-
+
public final String displayName;
-
+
private UsbSpeed( String dName )
{
this.displayName = dName;
@@ -254,7 +254,7 @@ public abstract class VmMetaData<T, U, V, W, X>
/**
* Called from subclass to set the OS. If the OS cannot be determined from the
* given parameters, it will not be set.
- *
+ *
* @param virtId
* virtualizer, eg "vmware" for VMware
* @param virtOsId
@@ -292,7 +292,7 @@ public abstract class VmMetaData<T, U, V, W, X>
*
* @param osList List of supported operating systems
* @param file VM's machine description file to get the metadata instance from
- * @return VmMetaData object representing the relevant parts of the given machine description
+ * @return VmMetaData object representing the relevant parts of the given machine description
*/
public static VmMetaData<?, ?, ?, ?, ?> getInstance( List<OperatingSystem> osList, File file )
throws IOException
@@ -313,11 +313,9 @@ public abstract class VmMetaData<T, U, V, W, X>
LOGGER.info( "Not a QEmu file", e );
}
try {
- // TODO This will work for each file because simple read as byte array
- // TODO No checks if file is a dockerfile --- THIS SHOOULD NOT BE IN PRODUCTION
return new DockerMetaDataDummy(osList, file);
} catch ( Exception e ) {
- LOGGER.info( "Not a docker file", e );
+ LOGGER.info( "Not a tar.gz file, for docker container", e );
}
LOGGER.error( "Could not detect any known virtualizer format" );
return null;
@@ -346,12 +344,9 @@ public abstract class VmMetaData<T, U, V, W, X>
exceptions.put( "Not a VirtualBox file", e );
}
try {
- // TODO This should work in each case, because no checks if vmContent is dockerfile
- // TODO --- THIS SHOULD NOT BE IN PRODUCTION
- LOGGER.info("Creating DockerMetaDataDummy from vmContent");
return new DockerMetaDataDummy(osList, vmContent, length);
- } catch (Exception e) {
- e.printStackTrace();
+ } catch (UnsupportedVirtualizerFormatException e) {
+ exceptions.put( "Not tar.gz file for DockerMetaDataDummy ", e);
}
// TODO QEmu -- hack above expects qcow2 file, so we can't do anything here yet
LOGGER.error( "Could not detect any known virtualizer format" );