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);
}
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);
}
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);
}
Aggregations