@@ -2067,9 +2067,7 @@ protected StartAnswer execute(StartCommand cmd) {
20672067 }
20682068
20692069 VirtualMachineDiskInfo matchingExistingDisk = getMatchingExistingDisk (diskInfoBuilder , vol , hyperHost , context );
2070- controllerKey = getDiskController (matchingExistingDisk , vol , vmSpec , ideControllerKey , scsiControllerKey );
2071- String diskController = getDiskController (vmMo , matchingExistingDisk , vol , controllerInfo );
2072-
2070+ String diskController = getDiskController (vmMo , matchingExistingDisk , vol , controllerInfo , deployAsIs );
20732071 if (DiskControllerType .getType (diskController ) == DiskControllerType .osdefault ) {
20742072 diskController = vmMo .getRecommendedDiskController (null );
20752073 }
@@ -3273,47 +3271,9 @@ private VirtualMachineDiskInfo getMatchingExistingDisk(VirtualMachineDiskInfoBui
32733271 return null ;
32743272 }
32753273
3276- private int getDiskController (VirtualMachineDiskInfo matchingExistingDisk , DiskTO vol , VirtualMachineTO vmSpec , int ideControllerKey , int scsiControllerKey ) {
3277-
3278- int controllerKey ;
3279- if (matchingExistingDisk != null ) {
3280- s_logger .info ("Chose disk controller based on existing information: " + matchingExistingDisk .getDiskDeviceBusName ());
3281- if (matchingExistingDisk .getDiskDeviceBusName ().startsWith ("ide" ))
3282- return ideControllerKey ;
3283- else
3284- return scsiControllerKey ;
3285- }
3286-
3287- if (vol .getType () == Volume .Type .ROOT ) {
3288- Map <String , String > vmDetails = vmSpec .getDetails ();
3289- if (vmDetails != null && vmDetails .get (VmDetailConstants .ROOT_DISK_CONTROLLER ) != null ) {
3290- if (vmDetails .get (VmDetailConstants .ROOT_DISK_CONTROLLER ).equalsIgnoreCase ("scsi" )) {
3291- s_logger .info ("Chose disk controller for vol " + vol .getType () + " -> scsi, based on root disk controller settings: "
3292- + vmDetails .get (VmDetailConstants .ROOT_DISK_CONTROLLER ));
3293- controllerKey = scsiControllerKey ;
3294- } else {
3295- s_logger .info ("Chose disk controller for vol " + vol .getType () + " -> ide, based on root disk controller settings: "
3296- + vmDetails .get (VmDetailConstants .ROOT_DISK_CONTROLLER ));
3297- controllerKey = ideControllerKey ;
3298- }
3299- } else {
3300- s_logger .info ("Chose disk controller for vol " + vol .getType () + " -> scsi. due to null root disk controller setting" );
3301- controllerKey = scsiControllerKey ;
3302- }
3303-
3304- } else {
3305- // DATA volume always use SCSI device
3306- s_logger .info ("Chose disk controller for vol " + vol .getType () + " -> scsi" );
3307- controllerKey = scsiControllerKey ;
3308- }
3309-
3310- return controllerKey ;
3311- }
3312-
3313- private String getDiskController (VirtualMachineMO vmMo , VirtualMachineDiskInfo matchingExistingDisk , DiskTO vol , Pair <String , String > controllerInfo ) throws Exception {
3314- int controllerKey ;
3274+ private String getDiskController (VirtualMachineMO vmMo , VirtualMachineDiskInfo matchingExistingDisk , DiskTO vol , Pair <String , String > controllerInfo , boolean deployAsIs ) throws Exception {
33153275 DiskControllerType controllerType = DiskControllerType .none ;
3316- if (matchingExistingDisk != null ) {
3276+ if (deployAsIs && matchingExistingDisk != null ) {
33173277 String currentBusName = matchingExistingDisk .getDiskDeviceBusName ();
33183278 if (currentBusName != null ) {
33193279 s_logger .info ("Chose disk controller based on existing information: " + currentBusName );
0 commit comments