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 <rohit.yadav@shapeblue.com>

This closes #554
This commit is contained in:
Likitha Shetty 2015-06-01 14:23:56 +05:30 committed by Rohit Yadav
parent 6e5d4a60da
commit cb50d1d827

View File

@ -1934,6 +1934,20 @@ public class VirtualMachineMO extends BaseMO {
throw new Exception("SCSI Controller Not Found");
}
public int getGenericScsiDeviceControllerKeyNoException() throws Exception {
List<VirtualDevice> 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<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
@ -2389,7 +2403,7 @@ public class VirtualMachineMO extends BaseMO {
List<Integer> existingUnitNumbers = new ArrayList<Integer>();
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) {