Search in sources :

Example 1 with VirtualLsiLogicSASController

use of com.vmware.vim25.VirtualLsiLogicSASController in project cloudstack by apache.

the class VirtualMachineMO method ensureLsiLogicSasDeviceControllers.

public void ensureLsiLogicSasDeviceControllers(int count, int availableBusNum) throws Exception {
    int scsiControllerKey = getLsiLogicSasDeviceControllerKeyNoException();
    if (scsiControllerKey < 0) {
        VirtualMachineConfigSpec vmConfig = new VirtualMachineConfigSpec();
        int busNum = availableBusNum;
        while (busNum < count) {
            VirtualLsiLogicSASController scsiController = new VirtualLsiLogicSASController();
            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 controller of type LsiLogic SAS.");
        }
    }
}
Also used : VirtualMachineConfigSpec(com.vmware.vim25.VirtualMachineConfigSpec) VirtualDeviceConfigSpec(com.vmware.vim25.VirtualDeviceConfigSpec) VirtualLsiLogicSASController(com.vmware.vim25.VirtualLsiLogicSASController) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException)

Example 2 with VirtualLsiLogicSASController

use of com.vmware.vim25.VirtualLsiLogicSASController 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 VirtualLsiLogicSASController

use of com.vmware.vim25.VirtualLsiLogicSASController 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) ArrayList(java.util.ArrayList) List(java.util.List) VirtualLsiLogicController(com.vmware.vim25.VirtualLsiLogicController)

Example 4 with VirtualLsiLogicSASController

use of com.vmware.vim25.VirtualLsiLogicSASController in project cloudstack by apache.

the class VirtualMachineMO method getScsiDiskControllerKeyNoException.

public int getScsiDiskControllerKeyNoException(String diskController, int scsiUnitNumber) throws Exception {
    List<VirtualDevice> devices = (List<VirtualDevice>) _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
    if (CollectionUtils.isNotEmpty(devices) && scsiUnitNumber >= 0) {
        int requiredScsiController = scsiUnitNumber / VmwareHelper.MAX_ALLOWED_DEVICES_SCSI_CONTROLLER;
        int scsiControllerDeviceCount = 0;
        DiskControllerType diskControllerType = DiskControllerType.getType(diskController);
        for (VirtualDevice device : devices) {
            if ((diskControllerType == DiskControllerType.lsilogic || diskControllerType == DiskControllerType.scsi) && device instanceof VirtualLsiLogicController) {
                if (scsiControllerDeviceCount == requiredScsiController) {
                    if (isValidScsiDiskController((VirtualLsiLogicController) device)) {
                        return ((VirtualLsiLogicController) device).getKey();
                    }
                    break;
                }
                scsiControllerDeviceCount++;
            } else if ((diskControllerType == DiskControllerType.lsisas1068 || diskControllerType == DiskControllerType.scsi) && device instanceof VirtualLsiLogicSASController) {
                if (scsiControllerDeviceCount == requiredScsiController) {
                    if (isValidScsiDiskController((VirtualLsiLogicSASController) device)) {
                        return ((VirtualLsiLogicSASController) device).getKey();
                    }
                    break;
                }
                scsiControllerDeviceCount++;
            } else if ((diskControllerType == DiskControllerType.pvscsi || diskControllerType == DiskControllerType.scsi) && device instanceof ParaVirtualSCSIController) {
                if (scsiControllerDeviceCount == requiredScsiController) {
                    if (isValidScsiDiskController((ParaVirtualSCSIController) device)) {
                        return ((ParaVirtualSCSIController) device).getKey();
                    }
                    break;
                }
                scsiControllerDeviceCount++;
            } else if ((diskControllerType == DiskControllerType.buslogic || diskControllerType == DiskControllerType.scsi) && device instanceof VirtualBusLogicController) {
                if (scsiControllerDeviceCount == requiredScsiController) {
                    if (isValidScsiDiskController((VirtualBusLogicController) device)) {
                        return ((VirtualBusLogicController) device).getKey();
                    }
                    break;
                }
                scsiControllerDeviceCount++;
            }
        }
    }
    return -1;
}
Also used : ParaVirtualSCSIController(com.vmware.vim25.ParaVirtualSCSIController) VirtualBusLogicController(com.vmware.vim25.VirtualBusLogicController) VirtualDevice(com.vmware.vim25.VirtualDevice) VirtualLsiLogicSASController(com.vmware.vim25.VirtualLsiLogicSASController) ArrayList(java.util.ArrayList) List(java.util.List) VirtualLsiLogicController(com.vmware.vim25.VirtualLsiLogicController)

Aggregations

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