Skip to content
Permalink
Browse files

[FIXED JENKINS-7883] Stopped (as opposed to terminated) slaves are co…

…unted against the active instance count for the purpose of launching; can prevent launching of instances
  • Loading branch information...
Francis Upton IV
Francis Upton IV committed Feb 15, 2012
1 parent f13f065 commit fb48500653bf851b59022b61ed3eb86ac60ab07f
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/main/java/hudson/plugins/ec2/EC2Cloud.java
@@ -39,6 +39,7 @@
import com.amazonaws.services.ec2.AmazonEC2Client;
import com.amazonaws.services.ec2.model.CreateKeyPairRequest;
import com.amazonaws.services.ec2.model.Instance;
import com.amazonaws.services.ec2.model.InstanceStateName;
import com.amazonaws.services.ec2.model.InstanceType;
import com.amazonaws.services.ec2.model.KeyPair;
import com.amazonaws.services.ec2.model.KeyPairInfo;
@@ -152,7 +153,8 @@ public int countCurrentEC2Slaves() throws AmazonClientException {
int n=0;
for (Reservation r : connect().describeInstances().getReservations()) {
for (Instance i : r.getInstances()) {
if(!"terminated".equals(i.getState().getName()))
InstanceStateName stateName = InstanceStateName.fromValue(i.getState().getName());
if (stateName == InstanceStateName.Pending || stateName == InstanceStateName.Running)
n++;
}
}

0 comments on commit fb48500

Please sign in to comment.
You can’t perform that action at this time.