diff options
author | Victor Mocanu | 2017-10-06 16:05:34 +0200 |
---|---|---|
committer | Victor Mocanu | 2017-10-06 16:05:34 +0200 |
commit | 64138d179bf0d9d2a0a1bd288ed91609293a0c7d (patch) | |
tree | 5b28be69b3f3e29a7faed2626d3f5b05f1613e12 /src/main/java/org/openslx/util/vm/VmwareMetaData.java | |
parent | [VBox] improved the create new tag and insert attribute functions (diff) | |
download | master-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/VmwareMetaData.java')
-rw-r--r-- | src/main/java/org/openslx/util/vm/VmwareMetaData.java | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/src/main/java/org/openslx/util/vm/VmwareMetaData.java b/src/main/java/org/openslx/util/vm/VmwareMetaData.java index 4a5266c..48bbe79 100644 --- a/src/main/java/org/openslx/util/vm/VmwareMetaData.java +++ b/src/main/java/org/openslx/util/vm/VmwareMetaData.java @@ -1,6 +1,5 @@ package org.openslx.util.vm; -import java.io.Console; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -11,13 +10,10 @@ import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.sql.ConnectionEventListener; - import org.apache.log4j.Logger; import org.openslx.bwlp.thrift.iface.OperatingSystem; import org.openslx.bwlp.thrift.iface.Virtualizer; import org.openslx.util.Util; -import org.openslx.util.vm.VmMetaData.TypeOf; import org.openslx.util.vm.VmwareConfig.ConfigEntry; public class VmwareMetaData extends VmMetaData @@ -172,7 +168,52 @@ public class VmwareMetaData extends VmMetaData device.present = Boolean.parseBoolean( value ); } } + + @Override + public boolean addHddTemplate( File diskImage, String hddMode, String redoDir) { + String diskImagePath = diskImage.getName(); + DriveBusType bus; + try { + bus = DriveBusType.valueOf( config.get( "#SLX_HDD_BUS" ) ); + } catch ( Exception e ) { + LOGGER.warn( "Unknown bus type: " + config.get( "#SLX_HDD_BUS" ) + ". Cannot add hdd config." ); + return false; + } + String chipset = config.get( "#SLX_HDD_CHIP" ); + String prefix; + switch ( bus ) { + case IDE: + prefix = "ide0:0"; + addFiltered( "ide0.present", "TRUE" ); + break; + case SATA: + // Cannot happen?... use lsisas1068 + case SCSI: + prefix = "scsi0:0"; + addFiltered( "scsi0.present", "TRUE" ); + if ( chipset != null ) { + addFiltered( "scsi0.virtualDev", chipset ); + } + break; + default: + LOGGER.warn( "Unknown HDD bus type: " + bus.toString() ); + return false; + } + // Gen + addFiltered( prefix + ".present", "TRUE" ); + addFiltered( prefix + ".deviceType", "disk" ); + addFiltered( prefix + ".fileName", diskImagePath ); + if ( hddMode != null ) { + addFiltered( prefix + ".mode", hddMode ); + addFiltered( prefix + ".redo", "" ); + addFiltered( prefix + ".redoLogDir", redoDir ); + } + config.remove( "#SLX_HDD_BUS" ); + config.remove( "#SLX_HDD_CHIP" ); + return true; + } + @Override public boolean addHddTemplate( String diskImagePath, String hddMode, String redoDir ) { DriveBusType bus; @@ -555,7 +596,7 @@ public class VmwareMetaData extends VmMetaData } return EthernetDevType.AUTO; } - + @Override public void setTypeOf() { @@ -566,6 +607,6 @@ public class VmwareMetaData extends VmMetaData public void reWrite() { // TODO Auto-generated method stub - + } } |