use of com.vmware.vim25.VirtualBusLogicController in project cloudstack by apache.
the class VirtualMachineMO method ensureBusLogicDeviceControllers.
public void ensureBusLogicDeviceControllers(int count, int availableBusNum) throws Exception {
int scsiControllerKey = getBusLogicDeviceControllerKeyNoException();
if (scsiControllerKey < 0) {
VirtualMachineConfigSpec vmConfig = new VirtualMachineConfigSpec();
int busNum = availableBusNum;
while (busNum < count) {
VirtualBusLogicController scsiController = new VirtualBusLogicController();
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 BusLogic controllers to the VM " + getName());
} else {
s_logger.info("Successfully added " + count + " SCSI BusLogic controllers.");
}
}
}
use of com.vmware.vim25.VirtualBusLogicController in project cloudstack by apache.
the class HypervisorHostHelper method getControllerSpec.
private static VirtualDeviceConfigSpec getControllerSpec(String diskController, int busNum) {
VirtualDeviceConfigSpec controllerSpec = new VirtualDeviceConfigSpec();
VirtualController controller = null;
if (diskController.equalsIgnoreCase(DiskControllerType.ide.toString())) {
controller = new VirtualIDEController();
} else if (DiskControllerType.pvscsi == DiskControllerType.getType(diskController)) {
controller = new ParaVirtualSCSIController();
} else if (DiskControllerType.lsisas1068 == DiskControllerType.getType(diskController)) {
controller = new VirtualLsiLogicSASController();
} else if (DiskControllerType.buslogic == DiskControllerType.getType(diskController)) {
controller = new VirtualBusLogicController();
} else if (DiskControllerType.lsilogic == DiskControllerType.getType(diskController)) {
controller = new VirtualLsiLogicController();
}
if (!diskController.equalsIgnoreCase(DiskControllerType.ide.toString())) {
((VirtualSCSIController) controller).setSharedBus(VirtualSCSISharing.NO_SHARING);
}
controller.setBusNumber(busNum);
controller.setKey(busNum - VmwareHelper.MAX_SCSI_CONTROLLER_COUNT);
controllerSpec.setDevice(controller);
controllerSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD);
return controllerSpec;
}
use of com.vmware.vim25.VirtualBusLogicController in project cloudstack by apache.
the class VirtualMachineMO method getScsiControllerInfo.
public Ternary<Integer, Integer, DiskControllerType> getScsiControllerInfo() throws Exception {
List<VirtualDevice> devices = (List<VirtualDevice>) _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
int scsiControllerCount = 0;
int busNum = -1;
DiskControllerType controllerType = DiskControllerType.lsilogic;
if (devices != null && devices.size() > 0) {
for (VirtualDevice device : devices) {
if (device instanceof VirtualSCSIController) {
scsiControllerCount++;
int deviceBus = ((VirtualSCSIController) device).getBusNumber();
if (busNum < deviceBus) {
busNum = deviceBus;
}
if (device instanceof VirtualLsiLogicController) {
controllerType = DiskControllerType.lsilogic;
} else if (device instanceof VirtualLsiLogicSASController) {
controllerType = DiskControllerType.lsisas1068;
} else if (device instanceof VirtualBusLogicController) {
controllerType = DiskControllerType.buslogic;
} else if (device instanceof ParaVirtualSCSIController) {
controllerType = DiskControllerType.pvscsi;
}
}
}
}
return new Ternary<Integer, Integer, DiskControllerType>(scsiControllerCount, busNum, controllerType);
}
Aggregations