Class HostWeights
java.lang.Object
org.jenkinsci.plugins.vsphere.tools.HostWeights
How much each of four measures of a host's free resources counts towards its score when
automatically choosing the "most available" host (see
VSphereHostSelection.rank(java.util.List<org.jenkinsci.plugins.vsphere.tools.VSphereHostSelection.HostCandidate>, org.jenkinsci.plugins.vsphere.tools.HostWeights)):
- free CPU in MHz (absolute: a big host with the same load percentage has more to give),
- free CPU as a share of the host's CPU capacity (relative: how idle the host is),
- free memory in MB (absolute),
- free memory as a share of the host's memory (relative).
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHostWeights(double freeCpuMhz, double freeCpuPercent, double freeMemoryMB, double freeMemoryPercent) -
Method Summary
Modifier and TypeMethodDescriptiondoubledoubledoubledoublebooleanTrue if no weight is set, meaning the original ranking applies.static HostWeightsparseOverride(String freeCpuMhz, String freeCpuPercent, String freeMemoryMB, String freeMemoryPercent) Builds the weights a single call (build step or template) sets for itself from the text of its four settings, already variable-expanded.toString()doubletotal()
-
Field Details
-
DEFAULT
All zero: the original ranking.
-
-
Constructor Details
-
HostWeights
public HostWeights(double freeCpuMhz, double freeCpuPercent, double freeMemoryMB, double freeMemoryPercent)
-
-
Method Details
-
parseOverride
@CheckForNull public static HostWeights parseOverride(@CheckForNull String freeCpuMhz, @CheckForNull String freeCpuPercent, @CheckForNull String freeMemoryMB, @CheckForNull String freeMemoryPercent) throws VSphereException Builds the weights a single call (build step or template) sets for itself from the text of its four settings, already variable-expanded. If none is set (all null or blank) there is no override and null is returned, meaning: use the cloud's weights. If any is set, these four values replace the cloud's weights entirely, those left blank counting as zero. Setting them all to0is therefore a way to get the original ranking despite weights on the cloud.- Throws:
VSphereException- if a value is set but is not a non-negative whole number
-
getFreeCpuMhz
public double getFreeCpuMhz() -
getFreeCpuPercent
public double getFreeCpuPercent() -
getFreeMemoryMB
public double getFreeMemoryMB() -
getFreeMemoryPercent
public double getFreeMemoryPercent() -
total
public double total() -
isDefault
public boolean isDefault()True if no weight is set, meaning the original ranking applies. -
toString
-