Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-57578

Clarify & extend Cloud.canProvision(Label) API

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core
    • None

      Summary:

      Split Cloud.canProvision(Label) API into two operations:

      • couldProvision(Label) - the Cloud supports this label.
      • canProvision(Label) - this Cloud supports this label and can provision it now.

      & clarify docs.

      Background:

      The [Javadoc|https://javadoc.jenkins.io/hudson/slaves/Cloud.html] for Cloud.canProvision(Label) says:

      "Returns true if this cloud is capable of provisioning new nodes for the given label."

      But this can be interpreted in different ways:

      • I can handle those labels.
      • I handle those labels and can provision something (I am not over subscribed).

      The problem with the first interpretation is that when this Cloud is oversubscribed it continues to return true preventing other Clouds from being asked to provision, so suggest clarifying that Javadoc to make clear that canProvision() has the second meaning.

      Then, we add another method with the first meaning, e.g. _could_Provision(Label). This is to support the case where a Cloud handles the label, but can't provision right now (since Clouds are cached in Labels.clouds and won't get refreshed until Jenkins.trimLabels() next runs).

       

       

       

            Unassigned Unassigned
            markwm Mark Wynn-Mackenzie
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: