use of com.vmware.vim25.VirtualLsiLogicController in project cloudstack by apache.
the class VirtualMachineMO method ensureScsiDeviceController.
public void ensureScsiDeviceController() throws Exception {
int scsiControllerKey = getScsiDeviceControllerKeyNoException();
if (scsiControllerKey < 0) {
VirtualMachineConfigSpec vmConfig = new VirtualMachineConfigSpec();
// Scsi controller
VirtualLsiLogicController scsiController = new VirtualLsiLogicController();
scsiController.setSharedBus(VirtualSCSISharing.NO_SHARING);
scsiController.setBusNumber(0);
scsiController.setKey(1);
VirtualDeviceConfigSpec scsiControllerSpec = new VirtualDeviceConfigSpec();
scsiControllerSpec.setDevice(scsiController);
scsiControllerSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD);
vmConfig.getDeviceChange().add(scsiControllerSpec);
if (configureVm(vmConfig)) {
throw new Exception("Unable to add Scsi controller");
}
}
}
use of com.vmware.vim25.VirtualLsiLogicController in project cloudstack by apache.
the class VirtualMachineMO method ensureScsiDeviceControllers.
public void ensureScsiDeviceControllers(int count, int availableBusNum) throws Exception {
int scsiControllerKey = getScsiDeviceControllerKeyNoException();
if (scsiControllerKey < 0) {
VirtualMachineConfigSpec vmConfig = new VirtualMachineConfigSpec();
int busNum = availableBusNum;
while (busNum < count) {
VirtualLsiLogicController scsiController = new VirtualLsiLogicController();
scsiController.setSharedBus(VirtualSCSISharing.NO_SHARING);
scsiController.setBusNumber(busNum);
scsiController.setKey(busNum - VmwareHelper.MAX_SCSI_CONTROLLER_COUNT);
VirtualDeviceConfigSpec scsiControllerSpec = new VirtualDeviceConfigSpec();
scsiControllerSpec.setDevice(scsiController);
scsiControllerSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD);
vmConfig.getDeviceChange().add(scsiControllerSpec);
busNum++;
}
if (configureVm(vmConfig)) {
throw new Exception("Unable to add Scsi controllers to the VM " + getName());
} else {
s_logger.info("Successfully added " + count + " SCSI controllers.");
}
}
}
Aggregations