Search in sources :

Example 6 with VirtualLsiLogicController

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

Example 7 with VirtualLsiLogicController

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

Aggregations

VirtualLsiLogicController (com.vmware.vim25.VirtualLsiLogicController)7 VirtualDeviceConfigSpec (com.vmware.vim25.VirtualDeviceConfigSpec)6 VirtualMachineConfigSpec (com.vmware.vim25.VirtualMachineConfigSpec)5 ParaVirtualSCSIController (com.vmware.vim25.ParaVirtualSCSIController)2 VirtualBusLogicController (com.vmware.vim25.VirtualBusLogicController)2 VirtualLsiLogicSASController (com.vmware.vim25.VirtualLsiLogicSASController)2 VirtualMachineFileInfo (com.vmware.vim25.VirtualMachineFileInfo)2 VirtualSCSIController (com.vmware.vim25.VirtualSCSIController)2 Ternary (com.cloud.utils.Ternary)1 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)1 VirtualController (com.vmware.vim25.VirtualController)1 VirtualDevice (com.vmware.vim25.VirtualDevice)1 VirtualIDEController (com.vmware.vim25.VirtualIDEController)1 VirtualMachineVideoCard (com.vmware.vim25.VirtualMachineVideoCard)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1