Class VmSize
java.lang.Object
org.jenkinsci.plugins.vsphere.tools.VmSize
The optional CPU and memory settings a VM is to be created with, in the same operation that
creates it, instead of being reconfigured afterwards. The properties mean the same as those of
the
ReconfigureCpu and ReconfigureMemory steps; a null one keeps the source's.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyTo(com.vmware.vim25.VirtualMachineConfigSpec spec) Puts the settings that are set into a configuration spec, leaving the others untouched.describe()For logging: what the VM will be created with.Cores per socket, or null to keep the source's.Number of vCPUs (asReconfigureCpu'scpuCores), or null to keep the source's.CPU reservation in MHz (asReconfigureCpu'scpuLimitMHz), or null for none.Memory size in MB (asReconfigureMemory'smemorySize), or null to keep the source's.booleanisEmpty()static VmSizeBuilds a size from the (already variable-expanded) text of the four settings; each may be null or blank, meaning "keep the source's".static IntegerparseOptionalPositive(String what, String value) Parses an optional, already variable-expanded positive whole number.voidvalidateAgainstSource(Integer sourceCpus, Integer sourceCoresPerSocket) vCenter refuses a vCPU count that is not a multiple of the cores per socket.
-
Field Details
-
NONE
Nothing set: the VM keeps the source's CPU and memory configuration.
-
-
Method Details
-
of
public static VmSize of(@CheckForNull String cpuCores, @CheckForNull String coresPerSocket, @CheckForNull String cpuLimitMHz, @CheckForNull String memorySize) throws VSphereException Builds a size from the (already variable-expanded) text of the four settings; each may be null or blank, meaning "keep the source's".- Throws:
VSphereException- if a setting is given but is not a positive whole number
-
parseOptionalPositive
@CheckForNull public static Integer parseOptionalPositive(String what, @CheckForNull String value) throws VSphereException Parses an optional, already variable-expanded positive whole number.- Parameters:
what- name of the setting for the error message- Returns:
- the number, or null if
valueis null or blank (meaning: keep the source's) - Throws:
VSphereException- if it is set but is not a positive whole number
-
getCpuCores
Number of vCPUs (asReconfigureCpu'scpuCores), or null to keep the source's. -
getCoresPerSocket
Cores per socket, or null to keep the source's. -
getCpuLimitMHz
CPU reservation in MHz (asReconfigureCpu'scpuLimitMHz), or null for none. -
getMemorySize
Memory size in MB (asReconfigureMemory'smemorySize), or null to keep the source's. -
isEmpty
public boolean isEmpty() -
validateAgainstSource
public void validateAgainstSource(@CheckForNull Integer sourceCpus, @CheckForNull Integer sourceCoresPerSocket) throws VSphereException vCenter refuses a vCPU count that is not a multiple of the cores per socket. Checks that with what the VM will end up with: the settings here, else the source's.- Throws:
VSphereException- if they do not fit together
-
applyTo
public void applyTo(com.vmware.vim25.VirtualMachineConfigSpec spec) Puts the settings that are set into a configuration spec, leaving the others untouched. -
describe
For logging: what the VM will be created with.
-