From cb50d1d82714f8178b6aefb32826719a97214b11 Mon Sep 17 00:00:00 2001 From: Likitha Shetty Date: Mon, 1 Jun 2015 14:23:56 +0530 Subject: [PATCH] CLOUDSTACK-8610. Unable to attach 7th Disk to Windows Server 2012 R2 instance. During disk attach, while trying to obtain the controller key for SCSI controller, look for device with the generic SCSI controller type i.e. VirtualSCSIController. Signed-off-by: Rohit Yadav This closes #554 --- .../hypervisor/vmware/mo/VirtualMachineMO.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java index dd7421ef253..c3a04b688da 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java @@ -1934,6 +1934,20 @@ public class VirtualMachineMO extends BaseMO { throw new Exception("SCSI Controller Not Found"); } + public int getGenericScsiDeviceControllerKeyNoException() throws Exception { + List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); + + if (devices != null && devices.size() > 0) { + for (VirtualDevice device : devices) { + if (device instanceof VirtualSCSIController) { + return device.getKey(); + } + } + } + + return -1; + } + public int getScsiDeviceControllerKeyNoException() throws Exception { List devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device"); @@ -2389,7 +2403,7 @@ public class VirtualMachineMO extends BaseMO { List existingUnitNumbers = new ArrayList(); int deviceNumber = 0; - int scsiControllerKey = getScsiDeviceControllerKeyNoException(); + int scsiControllerKey = getGenericScsiDeviceControllerKeyNoException(); if (devices != null && devices.size() > 0) { for (VirtualDevice device : devices) { if (device.getControllerKey() != null && device.getControllerKey().intValue() == controllerKey) {