Class ProvisioningFailureTracker

java.lang.Object
io.jenkins.plugins.kubevirt.ProvisioningFailureTracker

public final class ProvisioningFailureTracker extends Object
Tracks consecutive VM provisioning failures per template.

When a launch fails, the counter increments. A successful agent connection resets the counter. If consecutive failures exceed the template's retry count (KubeVirtTemplate.getMaxProvisionAttempts()), waiting queue items are cancelled so Jenkins does not provision VMs indefinitely. 0 fails after the first launch; -1 disables the limit.

  • Method Details

    • recordFailure

      public static int recordFailure(String templateId)
      Records a provisioning failure and returns the new failure count.
      Parameters:
      templateId - the KubeVirtTemplate.getId() of the failed template
      Returns:
      the updated consecutive failure count, or 0 if templateId is blank
    • getFailureCount

      public static int getFailureCount(String templateId)
      Returns the current failure count without modifying it.
    • reset

      public static void reset(String templateId)
      Clears the failure counter after a successful launch or after giving up.