From d2f840b5d8eaa4695da3293056893bba78eb8011 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 11 Sep 2015 14:04:22 +0200 Subject: [vmware] Allow setting disk mode when adding HDD --- .../java/org/openslx/util/vm/VmwareMetaData.java | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/main/java/org/openslx/util/vm/VmwareMetaData.java b/src/main/java/org/openslx/util/vm/VmwareMetaData.java index 25c052b..5ea806f 100644 --- a/src/main/java/org/openslx/util/vm/VmwareMetaData.java +++ b/src/main/java/org/openslx/util/vm/VmwareMetaData.java @@ -156,7 +156,7 @@ public class VmwareMetaData extends VmMetaData } } - public boolean addHddTemplate( String diskImagePath ) + public boolean addHddTemplate( String diskImagePath, String hddMode, String redoFile ) { DriveBusType bus; try { @@ -166,28 +166,34 @@ public class VmwareMetaData extends VmMetaData return false; } String chipset = config.get( "#SLX_HDD_CHIP" ); + String prefix; switch ( bus ) { case IDE: + prefix = "ide0:0"; addFiltered( "ide0.present", "TRUE" ); - addFiltered( "ide0:0.present", "TRUE" ); - addFiltered( "ide0:0.deviceType", "disk" ); - addFiltered( "ide0:0.fileName", diskImagePath ); - return true; + break; case SATA: // Cannot happen?... use lsisas1068 case SCSI: + prefix = "scsi0:0"; addFiltered( "scsi0.present", "TRUE" ); - addFiltered( "scsi0:0.present", "TRUE" ); - addFiltered( "scsi0:0.deviceType", "disk" ); - addFiltered( "scsi0:0.fileName", diskImagePath ); if ( chipset != null ) { addFiltered( "scsi0.virtualDev", chipset ); } - return true; + 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", redoFile ); + } + return true; } public boolean addDefaultNat() -- cgit v1.2.3-55-g7522