summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/util/vm/VmMetaData.java
diff options
context:
space:
mode:
authorVictor Mocanu2017-10-06 16:05:34 +0200
committerVictor Mocanu2017-10-06 16:05:34 +0200
commit64138d179bf0d9d2a0a1bd288ed91609293a0c7d (patch)
tree5b28be69b3f3e29a7faed2626d3f5b05f1613e12 /src/main/java/org/openslx/util/vm/VmMetaData.java
parent[VBox] improved the create new tag and insert attribute functions (diff)
downloadmaster-sync-shared-64138d179bf0d9d2a0a1bd288ed91609293a0c7d.tar.gz
master-sync-shared-64138d179bf0d9d2a0a1bd288ed91609293a0c7d.tar.xz
master-sync-shared-64138d179bf0d9d2a0a1bd288ed91609293a0c7d.zip
[VBox] added new uuid when downloading vm from server
uuid is now writen in the vdi too
Diffstat (limited to 'src/main/java/org/openslx/util/vm/VmMetaData.java')
-rw-r--r--src/main/java/org/openslx/util/vm/VmMetaData.java72
1 files changed, 34 insertions, 38 deletions
diff --git a/src/main/java/org/openslx/util/vm/VmMetaData.java b/src/main/java/org/openslx/util/vm/VmMetaData.java
index 27b0983..2636581 100644
--- a/src/main/java/org/openslx/util/vm/VmMetaData.java
+++ b/src/main/java/org/openslx/util/vm/VmMetaData.java
@@ -8,10 +8,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;
-import javax.print.attribute.standard.PrinterMessageFromOperator;
-import javax.swing.JOptionPane;
-
-import org.apache.log4j.FileAppender;
import org.apache.log4j.Logger;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
import org.openslx.bwlp.thrift.iface.Virtualizer;
@@ -27,12 +23,14 @@ public abstract class VmMetaData
* Helper types
*/
- public static enum TypeOf {
+ public static enum TypeOf
+ {
VMX,
VBOX;
}
-
+
public static TypeOf typeOf = null;
+
public static enum DriveBusType
{
SCSI,
@@ -126,7 +124,6 @@ public abstract class VmMetaData
protected final void setOs( String virtId, String virtOsId )
{
OperatingSystem lazyMatch = null;
- boolean x = false;
for ( OperatingSystem os : osList ) {
if ( os.getVirtualizerOsId() == null )
continue;
@@ -135,77 +132,75 @@ public abstract class VmMetaData
continue;
if ( entry.getKey().equals( virtId ) ) {
this.os = os;
- x = true;
return;
} else {
lazyMatch = os;
}
}
}
-
- /*if(!x) {
- //LOGGER.debug( "os with " + virtId + " " + virtOsId + " is not in list");
- }*/
this.os = lazyMatch;
}
-
+
public abstract void reWrite();
+
public abstract Virtualizer getVirtualizer();
-
- public abstract void enableUsb(boolean enabled);
-
+
+ public abstract void enableUsb( boolean enabled );
+
/**
* Apply config options that are desired when locally editing a VM.
* for vmware, this disables automatic DPI scaling of the guest.
*/
public abstract void applySettingsForLocalEdit();
-
+
// meta object needed when reading vm from file
- public static VmMetaData getInstance(List<OperatingSystem> osList, File file) throws IOException {
+ public static VmMetaData getInstance( List<OperatingSystem> osList, File file ) throws IOException
+ {
VmMetaData meta = null;
try {
- meta = new VmwareMetaData(osList, file);
+ meta = new VmwareMetaData( osList, file );
} catch ( UnsupportedVirtualizerFormatException e ) {
- LOGGER.debug( "datei war nicht .vmx; versuche mit VBox");
+ LOGGER.debug( "datei war nicht .vmx; versuche mit VBox" );
try {
- meta = new VboxMetaData(osList, file);
- }
- catch (UnsupportedVirtualizerFormatException ex) {
- LOGGER.debug( "datei war nicht .vbox; unterbrochen!" , ex);
+ meta = new VboxMetaData( osList, file );
+ } catch ( UnsupportedVirtualizerFormatException ex ) {
+ LOGGER.debug( "datei war nicht .vbox; unterbrochen!", ex );
// TODO ok so or throw new IOException?
}
}
- if (meta != null) {
+ if ( meta != null ) {
return meta;
}
return null;
}
-
+
// meta object needed when reading from configarray
- public static VmMetaData getInstance(List<OperatingSystem> osList, byte[] vmContent, int length) throws IOException {
-
+ public static VmMetaData getInstance( List<OperatingSystem> osList, byte[] vmContent, int length ) throws IOException
+ {
+
VmMetaData meta = null;
try {
meta = new VmwareMetaData( osList, vmContent, length );
- } catch (UnsupportedVirtualizerFormatException e) {
+ } catch ( UnsupportedVirtualizerFormatException e ) {
LOGGER.debug( "machine Description entspricht nicht vmx format; versuche mit VBox" );
try {
meta = new VboxMetaData( osList, vmContent, length );
- } catch (UnsupportedVirtualizerFormatException ex) {
- LOGGER.debug( "machine Description entspricht nicht vbox format ); unterbrochen!", ex);
+ } catch ( UnsupportedVirtualizerFormatException ex ) {
+ LOGGER.debug( "machine Description entspricht nicht vbox format ); unterbrochen!", ex );
}
- if (meta != null) {
+ if ( meta != null ) {
return meta;
}
return null;
}
-
+
return null;
}
+ public abstract boolean addHddTemplate( File diskImage, String hddMode, String redoDir );
public abstract boolean addHddTemplate( String diskImagePath, String hddMode, String redoDir );
-
+
public abstract boolean addDefaultNat();
public abstract void setOs( String vendorOsId );
@@ -217,10 +212,11 @@ public abstract class VmMetaData
public abstract void addFloppy( int index, String image, boolean readOnly );
public abstract boolean addCdrom( String image );
-
- public abstract void setTypeOf ( );
-
- public TypeOf getTypeOf () {
+
+ public abstract void setTypeOf();
+
+ public TypeOf getTypeOf()
+ {
return typeOf;
}
}