Search in sources :

Example 1 with ResourceAllocationInfo

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

the class VmwareHelper method setVmScaleUpConfig.

public static void setVmScaleUpConfig(VirtualMachineConfigSpec vmConfig, int cpuCount, int cpuSpeedMHz, int cpuReservedMhz, int memoryMB, int memoryReserveMB, boolean limitCpuUse) {
    // VM config for scaling up
    vmConfig.setMemoryMB((long) memoryMB);
    vmConfig.setNumCPUs(cpuCount);
    ResourceAllocationInfo cpuInfo = new ResourceAllocationInfo();
    if (limitCpuUse) {
        cpuInfo.setLimit((long) (cpuSpeedMHz * cpuCount));
    } else {
        cpuInfo.setLimit(-1L);
    }
    cpuInfo.setReservation((long) cpuReservedMhz);
    vmConfig.setCpuAllocation(cpuInfo);
    ResourceAllocationInfo memInfo = new ResourceAllocationInfo();
    memInfo.setLimit((long) memoryMB);
    memInfo.setReservation((long) memoryReserveMB);
    vmConfig.setMemoryAllocation(memInfo);
}
Also used : ResourceAllocationInfo(com.vmware.vim25.ResourceAllocationInfo)

Example 2 with ResourceAllocationInfo

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

the class VmwareHelper method setBasicVmConfig.

public static void setBasicVmConfig(VirtualMachineConfigSpec vmConfig, int cpuCount, int cpuSpeedMHz, int cpuReservedMhz, int memoryMB, int memoryReserveMB, String guestOsIdentifier, boolean limitCpuUse) {
    // VM config basics
    vmConfig.setMemoryMB((long) memoryMB);
    vmConfig.setNumCPUs(cpuCount);
    ResourceAllocationInfo cpuInfo = new ResourceAllocationInfo();
    if (limitCpuUse) {
        cpuInfo.setLimit(((long) cpuSpeedMHz * cpuCount));
    } else {
        cpuInfo.setLimit(-1L);
    }
    cpuInfo.setReservation((long) cpuReservedMhz);
    vmConfig.setCpuAllocation(cpuInfo);
    if (cpuSpeedMHz != cpuReservedMhz) {
        vmConfig.setCpuHotAddEnabled(true);
    }
    if (memoryMB != memoryReserveMB) {
        vmConfig.setMemoryHotAddEnabled(true);
    }
    ResourceAllocationInfo memInfo = new ResourceAllocationInfo();
    memInfo.setLimit((long) memoryMB);
    memInfo.setReservation((long) memoryReserveMB);
    vmConfig.setMemoryAllocation(memInfo);
    vmConfig.setGuestId(guestOsIdentifier);
}
Also used : ResourceAllocationInfo(com.vmware.vim25.ResourceAllocationInfo)

Example 3 with ResourceAllocationInfo

use of com.vmware.vim25.ResourceAllocationInfo in project CloudStack-archive by CloudStack-extras.

the class VmwareHelper method setBasicVmConfig.

public static void setBasicVmConfig(VirtualMachineConfigSpec vmConfig, int cpuCount, int cpuSpeedMHz, int cpuReservedMhz, int memoryMB, int memoryReserveMB, String guestOsIdentifier, boolean limitCpuUse) {
    // VM config basics
    vmConfig.setMemoryMB((long) memoryMB);
    vmConfig.setNumCPUs(cpuCount);
    ResourceAllocationInfo cpuInfo = new ResourceAllocationInfo();
    if (limitCpuUse) {
        cpuInfo.setLimit((long) (cpuSpeedMHz * cpuCount));
    } else {
        cpuInfo.setLimit(-1L);
    }
    cpuInfo.setReservation((long) cpuReservedMhz);
    vmConfig.setCpuAllocation(cpuInfo);
    ResourceAllocationInfo memInfo = new ResourceAllocationInfo();
    memInfo.setLimit((long) memoryMB);
    memInfo.setReservation((long) memoryReserveMB);
    vmConfig.setMemoryAllocation(memInfo);
    vmConfig.setGuestId(guestOsIdentifier);
}
Also used : ResourceAllocationInfo(com.vmware.vim25.ResourceAllocationInfo)

Aggregations

ResourceAllocationInfo (com.vmware.vim25.ResourceAllocationInfo)3