Class CloudProvisioningAlgorithm
java.lang.Object
org.jenkinsci.plugins.vsphere.tools.CloudProvisioningAlgorithm
How we decide what template to create the next agent on.
-
Method Summary
Modifier and TypeMethodDescriptionstatic CloudProvisioningRecordfindTemplateWithMostFreeCapacity(Collection<? extends CloudProvisioningRecord> provisionables) Given a bunch of templates to choose from, works out which one we should use next.static StringChooses a name for a new node.static intCompares sum of provisioned and planned nodes for the template.
-
Method Details
-
findTemplateWithMostFreeCapacity
public static CloudProvisioningRecord findTemplateWithMostFreeCapacity(Collection<? extends CloudProvisioningRecord> provisionables) Given a bunch of templates to choose from, works out which one we should use next.- Parameters:
provisionables- Template records to decide between.- Returns:
- The record with the most free capacity, or null if there are none with any capacity.
-
findUnusedName
Chooses a name for a new node. The name will start with thevSphereCloudSlaveTemplate.getCloneNamePrefix().- If the template has a limited number of instances available then the name will be of the form "prefixnumber" where "number" is a number that should be between 1 and the number of permitted instances.
- If the template has an unlimited number of instances available then the name will be of the form "prefixrandom" where "random" is a random UUID's 32-byte (128 bit) number (rendered using a high radix to keep the string short).
- Parameters:
record- Our record regarding the template the agent will be created from.- Returns:
- A name for the new node. This will start with the
vSphereCloudSlaveTemplate.getCloneNamePrefix().
-
shouldPreProvisionNodes
Compares sum of provisioned and planned nodes for the template. If the sum is less than instanceMin template value we should provision more nodes, otherwise the value is satisfied and we should not add any more nodes yet.- Parameters:
record- Our record regarding the template the agent will be created from.- Returns:
- A number of nodes to be provisioned.
-