Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
JENKINS-21363. Don't provision slaves while we're in quietdown or shu…
…tting-down
  • Loading branch information
abayer committed Feb 18, 2014
1 parent 7060575 commit 7dcedcb
Showing 1 changed file with 21 additions and 21 deletions.
@@ -1,20 +1,7 @@
package jenkins.plugins.jclouds.compute;

import hudson.Extension;
import hudson.Util;
import hudson.model.AutoCompletionCandidates;
import hudson.model.Computer;
import hudson.model.Descriptor;
import hudson.model.Hudson;
import hudson.model.Label;
import hudson.model.Node;
import hudson.slaves.Cloud;
import hudson.slaves.NodeProvisioner;
import hudson.slaves.NodeProvisioner.PlannedNode;
import hudson.util.FormValidation;
import hudson.util.StreamTaskListener;
import hudson.util.ListBoxModel;

import javax.annotation.Nullable;
import javax.servlet.ServletException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
Expand All @@ -28,9 +15,22 @@
import java.util.concurrent.Callable;
import java.util.logging.Logger;

import javax.annotation.Nullable;
import javax.servlet.ServletException;

import com.google.inject.Module;
import hudson.Extension;
import hudson.Util;
import hudson.model.AutoCompletionCandidates;
import hudson.model.Computer;
import hudson.model.Descriptor;
import hudson.model.Hudson;
import hudson.model.Label;
import hudson.model.Node;
import hudson.slaves.Cloud;
import hudson.slaves.NodeProvisioner;
import hudson.slaves.NodeProvisioner.PlannedNode;
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;
import hudson.util.StreamTaskListener;
import jenkins.model.Jenkins;
import org.jclouds.Constants;
import org.jclouds.ContextBuilder;
import org.jclouds.apis.Apis;
Expand All @@ -49,7 +49,6 @@
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import shaded.com.google.common.base.Objects;
import shaded.com.google.common.base.Predicate;
import shaded.com.google.common.base.Strings;
Expand All @@ -58,7 +57,6 @@
import shaded.com.google.common.collect.ImmutableSortedSet;
import shaded.com.google.common.collect.Iterables;
import shaded.com.google.common.io.Closeables;
import com.google.inject.Module;

/**
* The JClouds version of the Jenkins Cloud.
Expand Down Expand Up @@ -192,7 +190,9 @@ public Collection<NodeProvisioner.PlannedNode> provision(Label label, int excess
final JCloudsSlaveTemplate t = getTemplate(label);

List<PlannedNode> r = new ArrayList<PlannedNode>();
while (excessWorkload > 0) {
while (excessWorkload > 0
&& !Jenkins.getInstance().isQuietingDown()
&& !Jenkins.getInstance().isTerminating()) {
if ((getRunningNodesCount() + r.size()) >= instanceCap) {
LOGGER.info("Instance cap reached while adding capacity for label " + ((label != null) ? label.toString() : "null"));
break; // maxed out
Expand Down

1 comment on commit 7dcedcb

@vania-pooh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't get how to build this updated code. First of all how can I build the plugin now? Should I change directory to jclouds-plugin? It seems that when doing $ mvn clean install hpi:run from the root directory no tests are launched.

Please sign in to comment.