Class HostSelectionOptions

java.lang.Object
org.jenkinsci.plugins.vsphere.tools.HostSelectionOptions

public final class HostSelectionOptions extends Object
Optional refinements for automatic host selection (see VSphereHostSelection), already resolved from cloud-level defaults and call-site overrides, so VSphere only has to apply them.
  • Field Details

  • Constructor Details

    • HostSelectionOptions

      public HostSelectionOptions(boolean requireCores, boolean requireMemory)
    • HostSelectionOptions

      public HostSelectionOptions(boolean requireCores, boolean requireMemory, boolean requireAvailableMemory)
  • Method Details

    • withVmSize

      public HostSelectionOptions withVmSize(@CheckForNull Integer vmCpus, @CheckForNull Long vmMemoryMB)
      Same options, but telling the host size checks to compare against this vCPU count and memory size (null: unknown, use the source VM's) instead of the source VM's own - for VMs that are known to be resized right after being cloned.
    • withWeights

      public HostSelectionOptions withWeights(@CheckForNull HostWeights weights)
      Same options, ranking the candidate hosts with these weights.
    • getWeights

      public HostWeights getWeights()
      What "most available host" means; HostWeights.DEFAULT for the original ranking.
    • getVmCpus

      @CheckForNull public Integer getVmCpus()
      vCPU count the VM will end up with, if known ahead of cloning; else null.
    • getVmMemoryMB

      @CheckForNull public Long getVmMemoryMB()
      Memory size in MB the VM will end up with, if known ahead of cloning; else null.
    • isRequireCores

      public boolean isRequireCores()
      Only consider hosts with at least as many physical cores as the VM has vCPUs.
    • isRequireAvailableMemory

      public boolean isRequireAvailableMemory()
      Only consider hosts that currently have at least as much memory free as the VM is configured with, so the new VM does not push the host into swapping.
    • isRequireMemory

      public boolean isRequireMemory()
      Only consider hosts with at least as much physical RAM as the VM is configured with.
    • resolve

      public static boolean resolve(boolean cloudDefault, @CheckForNull Boolean override)
      Resolves a tri-state call-site setting against the cloud-wide default: null (never set at the call site) inherits cloudDefault; an explicit TRUE or FALSE wins outright.
    • triStateToString

      public static String triStateToString(@CheckForNull Boolean value)
      The form representation of a tri-state setting: "" for unset (inherit), else "true"/"false". Needed because Stapler binds an empty form value to an explicit false for a Boolean property, which would silently override the cloud's default instead of inheriting it.
    • triStateFromString

      @CheckForNull public static Boolean triStateFromString(@CheckForNull String value)
      Inverse of triStateToString(java.lang.Boolean): blank or anything unrecognised means unset (inherit).
    • triStateItems

      public static ListBoxModel triStateItems()
      Drop-down for a tri-state call-site setting: inherit the cloud's default, or force yes/no.