Search in sources :

Example 1 with VirtualBusLogicController

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.");
        }
    }
}
Also used : VirtualMachineConfigSpec(com.vmware.vim25.VirtualMachineConfigSpec) VirtualBusLogicController(com.vmware.vim25.VirtualBusLogicController) VirtualDeviceConfigSpec(com.vmware.vim25.VirtualDeviceConfigSpec)

Example 2 with VirtualBusLogicController

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;
}
Also used : VirtualController(com.vmware.vim25.VirtualController) VirtualIDEController(com.vmware.vim25.VirtualIDEController) ParaVirtualSCSIController(com.vmware.vim25.ParaVirtualSCSIController) VirtualBusLogicController(com.vmware.vim25.VirtualBusLogicController) VirtualDeviceConfigSpec(com.vmware.vim25.VirtualDeviceConfigSpec) ParaVirtualSCSIController(com.vmware.vim25.ParaVirtualSCSIController) VirtualSCSIController(com.vmware.vim25.VirtualSCSIController) VirtualLsiLogicSASController(com.vmware.vim25.VirtualLsiLogicSASController) VirtualLsiLogicController(com.vmware.vim25.VirtualLsiLogicController)

Example 3 with VirtualBusLogicController

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);
}
Also used : VirtualBusLogicController(com.vmware.vim25.VirtualBusLogicController) ParaVirtualSCSIController(com.vmware.vim25.ParaVirtualSCSIController) ParaVirtualSCSIController(com.vmware.vim25.ParaVirtualSCSIController) VirtualSCSIController(com.vmware.vim25.VirtualSCSIController) Ternary(com.cloud.utils.Ternary) VirtualDevice(com.vmware.vim25.VirtualDevice) VirtualLsiLogicSASController(com.vmware.vim25.VirtualLsiLogicSASController) List(java.util.List) ArrayList(java.util.ArrayList) VirtualLsiLogicController(com.vmware.vim25.VirtualLsiLogicController)

Aggregations

VirtualBusLogicController (com.vmware.vim25.VirtualBusLogicController)3 ParaVirtualSCSIController (com.vmware.vim25.ParaVirtualSCSIController)2 VirtualDeviceConfigSpec (com.vmware.vim25.VirtualDeviceConfigSpec)2 VirtualLsiLogicController (com.vmware.vim25.VirtualLsiLogicController)2 VirtualLsiLogicSASController (com.vmware.vim25.VirtualLsiLogicSASController)2 VirtualSCSIController (com.vmware.vim25.VirtualSCSIController)2 Ternary (com.cloud.utils.Ternary)1 VirtualController (com.vmware.vim25.VirtualController)1 VirtualDevice (com.vmware.vim25.VirtualDevice)1 VirtualIDEController (com.vmware.vim25.VirtualIDEController)1 VirtualMachineConfigSpec (com.vmware.vim25.VirtualMachineConfigSpec)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1