Permalink
Browse files

merge team/clc-dev/services to testing

  • Loading branch information...
2 parents df99a85 + d2a978d commit 255b1f45117d60ff95b55a5cbf0da58743926cef @sangmin sangmin committed Mar 14, 2013
Showing with 9,120 additions and 1,144 deletions.
  1. +7 −4 ...les/autoscaling-common/src/main/java/com/eucalyptus/autoscaling/common/AutoScalingMessages.groovy
  2. +4 −0 ...dules/autoscaling-common/src/main/java/com/eucalyptus/autoscaling/common/AutoScalingMetadata.java
  3. +2 −2 clc/modules/autoscaling-common/src/main/resources/autoscaling-binding.xml
  4. +114 −27 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/AutoScalingService.java
  5. +876 −54 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/ActivityManager.java
  6. +24 −17 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/BackoffRunner.java
  7. +11 −4 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/DispatchingClient.java
  8. +108 −0 ...ing/src/main/java/com/eucalyptus/autoscaling/activities/PersistenceZoneUnavailabilityMarkers.java
  9. +33 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/VmTypesClient.java
  10. +172 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/ZoneMonitor.java
  11. +50 −0 ...les/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/ZoneMonitorEventListener.java
  12. +58 −0 ...les/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/ZoneUnavailabilityMarker.java
  13. +45 −0 ...es/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/ZoneUnavailabilityMarkers.java
  14. +30 −9 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/groups/AutoScalingGroup.java
  15. +44 −3 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/groups/AutoScalingGroups.java
  16. +23 −0 ...les/autoscaling/src/main/java/com/eucalyptus/autoscaling/groups/PersistenceAutoScalingGroups.java
  17. +66 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/groups/ScalingProcessType.java
  18. +96 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/groups/SuspendedProcess.java
  19. +58 −3 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/instances/AutoScalingInstance.java
  20. +13 −1 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/instances/AutoScalingInstances.java
  21. +92 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/instances/ConfigurationState.java
  22. +26 −3 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/instances/HealthStatus.java
  23. +73 −2 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/instances/LifecycleState.java
  24. +97 −5 ...toscaling/src/main/java/com/eucalyptus/autoscaling/instances/PersistenceAutoScalingInstances.java
  25. +31 −1 ...dules/autoscaling/src/main/java/com/eucalyptus/autoscaling/metadata/AbstractOwnedPersistents.java
  26. +1 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/tags/AutoScalingGroupTag.java
  27. +21 −2 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/tags/Tag.java
  28. +37 −1 clc/modules/autoscaling/src/test/java/com/eucalyptus/autoscaling/AutoScalingServiceTest.groovy
  29. +813 −78 ...odules/autoscaling/src/test/java/com/eucalyptus/autoscaling/activities/ActivityManagerTest.groovy
  30. +25 −1 clc/modules/autoscaling/src/test/java/com/eucalyptus/autoscaling/activities/TestClients.java
  31. +7 −4 clc/modules/{cluster-manager → cloud}/src/main/java/com/eucalyptus/vmtypes/VmTypeMessages.groovy
  32. +7 −3 clc/modules/cloudwatch-common/src/main/java/com/eucalyptus/cloudwatch/CloudWatchMessages.groovy
  33. +1 −1 clc/modules/cloudwatch-common/src/main/resources/cloudwatch-binding.xml
  34. +215 −16 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/CloudWatchService.java
  35. +599 −0 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/alarms/AlarmEntity.java
  36. +108 −0 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/alarms/AlarmHistory.java
  37. +478 −0 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/alarms/AlarmManager.java
  38. +37 −0 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/alarms/AlarmState.java
  39. +43 −0 ...udwatch/src/main/java/com/eucalyptus/cloudwatch/domain/alarms/AlarmStateEvaluationDispatcher.java
  40. +177 −0 .../cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/alarms/AlarmStateEvaluationWorker.java
  41. +125 −0 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/alarms/AlarmUtils.java
  42. +66 −0 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/cpu/CPUUtilizationEntity.java
  43. +72 −0 ...dwatch/src/main/java/com/eucalyptus/cloudwatch/domain/cpu/CPUUtilizationPercentageCalculator.java
  44. +10 −0 ...ch/src/main/java/com/eucalyptus/cloudwatch/domain/dimension/AbstractPersistentWithDimensions.java
  45. +0 −8 .../src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/GetMetricStatisticsAggregationKey.java
  46. +33 −0 ...modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/MetricDataQueue.java
  47. +0 −9 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/MetricEntity.java
  48. +1 −9 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/MetricManager.java
  49. +10 −0 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/MetricUtils.java
  50. +4 −2 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/ws/CloudWatchErrorHandler.java
  51. +3 −1 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/ws/CloudWatchQueryPipeline.java
  52. +3 −1 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/ws/CloudWatchSoapPipeline.java
  53. +186 −4 ...modules/cluster-manager/src/main/java/com/eucalyptus/cluster/callback/DescribeSensorCallback.java
  54. +0 −2 clc/modules/cluster-manager/src/main/java/com/eucalyptus/images/ImageManager.java
  55. +1 −1 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmBootRecord.java
  56. +25 −4 clc/modules/dns/src/main/java/com/eucalyptus/cloud/ws/DNSControl.java
  57. +19 −4 ...ules/loadbalancing-common/src/main/java/com/eucalyptus/loadbalancing/LoadBalancingMessages.groovy
  58. +2 −2 clc/modules/loadbalancing-common/src/main/resources/loadbalancing-binding.xml
  59. +60 −23 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancer.java
  60. +56 −1 ...modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancerBackendInstance.java
  61. +150 −0 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancerDnsRecord.java
  62. +0 −40 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancerListener.java
  63. +143 −0 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancerSecurityGroup.java
  64. +31 −45 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancerZone.java
  65. +82 −7 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancers.java
  66. +1 −1 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancingException.java
  67. +772 −430 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancingService.java
  68. +44 −0 ...les/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/AbstractEventHandler.java
  69. +56 −13 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/ActivityManager.java
  70. +35 −0 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/DnsClient.java
  71. +34 −0 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EmpyreanClient.java
  72. +37 −0 ...dbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EucalyptusActivityException.java
  73. +606 −42 .../loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EucalyptusActivityTasks.java
  74. +5 −3 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandler.java
  75. +32 −8 ...odules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChain.java
  76. +431 −0 .../loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChainDelete.java
  77. +80 −0 ...ncing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChainDeleteListeners.java
  78. +44 −0 ...adbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChainException.java
  79. +492 −0 ...les/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChainNew.java
  80. +113 −0 ...alancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChainNewListeners.java
  81. +7 −96 ...dules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChains.java
  82. +49 −0 ...es/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerException.java
  83. +89 −87 ...oadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/LoadBalancerServoInstance.java
  84. +151 −33 ...balancing/src/main/java/com/eucalyptus/loadbalancing/activities/LoadbalancerInstanceLauncher.java
  85. +23 −6 ...es/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/LoadbalancingEvents.groovy
  86. +30 −0 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/StoredResult.java
  87. +2 −2 ...odules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/ws/LoadBalancingQueryBinding.java
  88. +1 −3 ...dules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/ws/LoadBalancingQueryPipeline.java
  89. +64 −9 clc/modules/msgs/src/main/java/com/eucalyptus/auth/policy/PolicySpec.java
  90. +5 −5 clc/modules/msgs/src/main/java/com/eucalyptus/binding/BindingException.java
  91. +66 −1 clc/modules/msgs/src/main/java/com/eucalyptus/util/CollectionUtils.java
  92. +1 −1 clc/modules/msgs/src/main/java/com/eucalyptus/ws/protocol/BaseQueryBinding.java
  93. +46 −0 clc/modules/msgs/src/main/resources/2013-02-01-binding.xml
@@ -147,6 +147,9 @@ public class PutScheduledUpdateGroupActionResponseType extends AutoScalingMessag
public class ProcessType extends EucalyptusData {
String processName
public ProcessType() { }
+ public ProcessType( String processName ) {
+ this.processName = processName
+ }
}
public class TagDescription extends EucalyptusData {
String resourceId
@@ -251,7 +254,7 @@ public class Activity extends EucalyptusData {
}
public class SuspendedProcesses extends EucalyptusData {
public SuspendedProcesses() { }
- ArrayList<SuspendedProcess> member = new ArrayList<SuspendedProcess>()
+ ArrayList<SuspendedProcessType> member = new ArrayList<SuspendedProcessType>()
}
public class InstanceMonitoring extends EucalyptusData {
Boolean enabled
@@ -453,10 +456,10 @@ public class PutScheduledUpdateGroupActionType extends AutoScalingMessage {
Integer desiredCapacity
public PutScheduledUpdateGroupActionType() { }
}
-public class SuspendedProcess extends EucalyptusData {
+public class SuspendedProcessType extends EucalyptusData {
String processName
String suspensionReason
- public SuspendedProcess() { }
+ public SuspendedProcessType() { }
}
public class SecurityGroups extends EucalyptusData {
public SecurityGroups() { }
@@ -912,7 +915,7 @@ public class DescribeAdjustmentTypesResult extends EucalyptusData {
}
}
public class DescribeScalingProcessTypesResult extends EucalyptusData {
- Processes processes
+ Processes processes = new Processes()
public DescribeScalingProcessTypesResult() { }
}
public class DescribeAutoScalingNotificationTypesResult extends EucalyptusData {
@@ -54,4 +54,8 @@
@PolicyResourceType( "tag" )
public interface AutoScalingTagMetadata extends AutoScalingMetadata {}
+
+ @PolicyResourceType( "scalingprocesstype" )
+ public interface ScalingProcessTypeMetadata extends AutoScalingMetadata {}
+
}
@@ -465,7 +465,7 @@
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.SuspendedProcesses" abstract="true">
<collection field="member">
- <structure name="member" type="com.eucalyptus.autoscaling.common.SuspendedProcess"/>
+ <structure name="member" type="com.eucalyptus.autoscaling.common.SuspendedProcessType"/>
</collection>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.LoadBalancerNames" abstract="true">
@@ -685,7 +685,7 @@
<structure name="member" type="com.eucalyptus.autoscaling.common.MetricGranularityType"/>
</collection>
</mapping>
- <mapping class="com.eucalyptus.autoscaling.common.SuspendedProcess" abstract="true">
+ <mapping class="com.eucalyptus.autoscaling.common.SuspendedProcessType" abstract="true">
<value name="ProcessName" field="processName" usage="optional"/>
<value name="SuspensionReason" field="suspensionReason" usage="optional"/>
</mapping>
@@ -29,6 +29,7 @@
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
+import java.util.NoSuchElementException;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.Logger;
@@ -101,6 +102,7 @@
import com.eucalyptus.autoscaling.common.Instance;
import com.eucalyptus.autoscaling.common.Instances;
import com.eucalyptus.autoscaling.common.LaunchConfigurationType;
+import com.eucalyptus.autoscaling.common.ProcessType;
import com.eucalyptus.autoscaling.common.PutNotificationConfigurationResponseType;
import com.eucalyptus.autoscaling.common.PutNotificationConfigurationType;
import com.eucalyptus.autoscaling.common.PutScalingPolicyResponseType;
@@ -130,6 +132,8 @@
import com.eucalyptus.autoscaling.groups.AutoScalingGroups;
import com.eucalyptus.autoscaling.groups.HealthCheckType;
import com.eucalyptus.autoscaling.groups.PersistenceAutoScalingGroups;
+import com.eucalyptus.autoscaling.groups.ScalingProcessType;
+import com.eucalyptus.autoscaling.groups.SuspendedProcess;
import com.eucalyptus.autoscaling.groups.TerminationPolicyType;
import com.eucalyptus.autoscaling.instances.AutoScalingInstance;
import com.eucalyptus.autoscaling.instances.AutoScalingInstances;
@@ -150,6 +154,7 @@
import com.eucalyptus.context.Contexts;
import com.eucalyptus.entities.Entities;
import com.eucalyptus.entities.TransactionException;
+import com.eucalyptus.records.Logs;
import com.eucalyptus.util.Callback;
import com.eucalyptus.util.EucalyptusCloudException;
import com.eucalyptus.util.Exceptions;
@@ -255,8 +260,41 @@ public EnableMetricsCollectionResponseType enableMetricsCollection(EnableMetrics
return reply;
}
- public ResumeProcessesResponseType resumeProcesses(ResumeProcessesType request) throws EucalyptusCloudException {
- ResumeProcessesResponseType reply = request.getReply( );
+ public ResumeProcessesResponseType resumeProcesses( final ResumeProcessesType request ) throws EucalyptusCloudException {
+ final ResumeProcessesResponseType reply = request.getReply( );
+
+ final Context ctx = Contexts.lookup( );
+ try {
+ final AccountFullName accountFullName = ctx.getUserFullName().asAccountFullName();
+ final Callback<AutoScalingGroup> groupCallback = new Callback<AutoScalingGroup>() {
+ @Override
+ public void fire( final AutoScalingGroup autoScalingGroup ) {
+ if ( RestrictedTypes.filterPrivileged().apply( autoScalingGroup ) ) {
+ final Set<ScalingProcessType> processesToResume = EnumSet.allOf( ScalingProcessType.class );
+ if ( request.getScalingProcesses() != null && !request.getScalingProcesses().getMember().isEmpty() ) {
+ processesToResume.clear();
+ Iterables.addAll( processesToResume, Iterables.transform(
+ request.getScalingProcesses().getMember(),
+ Enums.valueOfFunction(ScalingProcessType.class) ) );
+ }
+ for ( final ScalingProcessType scalingProcessType : processesToResume ) {
+ autoScalingGroup.getSuspendedProcesses().remove(
+ SuspendedProcess.createManual( scalingProcessType ) );
+ }
+ }
+ }
+ };
+
+ autoScalingGroups.update(
+ accountFullName,
+ request.getAutoScalingGroupName(),
+ groupCallback );
+ } catch ( AutoScalingMetadataNotFoundException e ) {
+ throw new InvalidParameterValueException( "Auto scaling group not found: " + request.getAutoScalingGroupName() );
+ } catch ( Exception e ) {
+ handleException( e );
+ }
+
return reply;
}
@@ -313,8 +351,14 @@ public DescribePoliciesResponseType describePolicies(final DescribePoliciesType
return reply;
}
- public DescribeScalingProcessTypesResponseType describeScalingProcessTypes(DescribeScalingProcessTypesType request) throws EucalyptusCloudException {
- DescribeScalingProcessTypesResponseType reply = request.getReply( );
+ public DescribeScalingProcessTypesResponseType describeScalingProcessTypes( final DescribeScalingProcessTypesType request) throws EucalyptusCloudException {
+ final DescribeScalingProcessTypesResponseType reply = request.getReply( );
+
+ final List<ProcessType> policies = reply.getDescribeScalingProcessTypesResult().getProcesses().getMember();
+ policies.addAll( Collections2.transform(
+ Collections2.filter( EnumSet.allOf( ScalingProcessType.class ), RestrictedTypes.filterPrivilegedWithoutOwner() ),
+ TypeMappers.lookup( ScalingProcessType.class, ProcessType.class )) );
+
return reply;
}
@@ -712,21 +756,26 @@ public boolean apply( final Void v ) {
try {
for ( final TagType tagType : request.getTags().getMember() ) {
final TagSupport tagSupport = TagSupport.fromResourceType( tagType.getResourceType() );
- AutoScalingMetadata resource = tagSupport.lookup( accountFullName, tagType.getResourceId() );
-
- if ( !RestrictedTypes.filterPrivileged().apply( resource ) ) {
- throw Exceptions.toUndeclared( new InvalidParameterValueException( "Resource not found " + tagType.getResourceId() ) );
+ AutoScalingMetadata resource = null;
+ try {
+ resource = tagSupport.lookup( accountFullName, tagType.getResourceId() );
+ } catch ( NoSuchElementException e ) {
+ Logs.extreme().info( e, e );
}
- final Tag example = tagSupport.example( resource, accountFullName, null, null );
- if ( Entities.count( example ) >= MAX_TAGS_PER_RESOURCE ) {
- throw Exceptions.toUndeclared( new LimitExceededException("Tag limit exceeded for resource '"+resource.getDisplayName()+"'") );
+ if ( resource == null || !RestrictedTypes.filterPrivileged().apply( resource ) ) {
+ throw Exceptions.toUndeclared( new InvalidParameterValueException( "Resource not found " + tagType.getResourceId() ) );
}
final String key = com.google.common.base.Strings.nullToEmpty( tagType.getKey() ).trim();
final String value = com.google.common.base.Strings.nullToEmpty( tagType.getValue() ).trim();
final Boolean propagateAtLaunch = Objects.firstNonNull( tagType.getPropagateAtLaunch(), Boolean.FALSE );
tagSupport.createOrUpdate( resource, ownerFullName, key, value, propagateAtLaunch );
+
+ final Tag example = tagSupport.example( resource, accountFullName, null, null );
+ if ( Entities.count( example ) > MAX_TAGS_PER_RESOURCE ) {
+ throw Exceptions.toUndeclared( new LimitExceededException("Tag limit exceeded for resource '"+resource.getDisplayName()+"'") );
+ }
}
return true;
} catch ( Exception e ) {
@@ -745,8 +794,43 @@ public boolean apply( final Void v ) {
return reply;
}
- public SuspendProcessesResponseType suspendProcesses(SuspendProcessesType request) throws EucalyptusCloudException {
- SuspendProcessesResponseType reply = request.getReply( );
+ public SuspendProcessesResponseType suspendProcesses( final SuspendProcessesType request ) throws EucalyptusCloudException {
+ final SuspendProcessesResponseType reply = request.getReply( );
+
+ final Context ctx = Contexts.lookup( );
+ try {
+ final AccountFullName accountFullName = ctx.getUserFullName().asAccountFullName();
+ final Callback<AutoScalingGroup> groupCallback = new Callback<AutoScalingGroup>() {
+ @Override
+ public void fire( final AutoScalingGroup autoScalingGroup ) {
+ if ( RestrictedTypes.filterPrivileged().apply( autoScalingGroup ) ) {
+ final Set<ScalingProcessType> processesToSuspend = EnumSet.allOf( ScalingProcessType.class );
+ if ( request.getScalingProcesses() != null && !request.getScalingProcesses().getMember().isEmpty() ) {
+ processesToSuspend.clear();
+ Iterables.addAll( processesToSuspend, Iterables.transform(
+ request.getScalingProcesses().getMember(),
+ Enums.valueOfFunction(ScalingProcessType.class) ) );
+ }
+ for ( final ScalingProcessType scalingProcessType : processesToSuspend ) {
+ if ( scalingProcessType.apply( autoScalingGroup ) ) {
+ autoScalingGroup.getSuspendedProcesses().add(
+ SuspendedProcess.createManual( scalingProcessType ) );
+ }
+ }
+ }
+ }
+ };
+
+ autoScalingGroups.update(
+ accountFullName,
+ request.getAutoScalingGroupName(),
+ groupCallback );
+ } catch ( AutoScalingMetadataNotFoundException e ) {
+ throw new InvalidParameterValueException( "Auto scaling group not found: " + request.getAutoScalingGroupName() );
+ } catch ( Exception e ) {
+ handleException( e );
+ }
+
return reply;
}
@@ -809,6 +893,7 @@ public LaunchConfiguration get( ) {
final List<String> referenceErrors = activityManager.validateReferences(
ctx.getUserFullName(),
Iterables.filter( Lists.newArrayList( request.getImageId(), request.getKernelId(), request.getRamdiskId() ), Predicates.notNull() ),
+ request.getInstanceType(),
request.getKeyName(),
request.getSecurityGroups() == null ? Collections.<String>emptyList() : request.getSecurityGroups().getMember()
);
@@ -883,11 +968,11 @@ public UpdateAutoScalingGroupResponseType updateAutoScalingGroup( final UpdateAu
public void fire( final AutoScalingGroup autoScalingGroup ) {
if ( RestrictedTypes.filterPrivileged().apply( autoScalingGroup ) ) {
if ( request.availabilityZones() != null && !request.availabilityZones().isEmpty() )
- autoScalingGroup.setAvailabilityZones( Lists.newArrayList( Sets.newLinkedHashSet( request.availabilityZones() ) ) );
+ autoScalingGroup.updateAvailabilityZones( Lists.newArrayList( Sets.newLinkedHashSet( request.availabilityZones() ) ) );
if ( request.getDefaultCooldown() != null )
autoScalingGroup.setDefaultCooldown( Numbers.intValue( request.getDefaultCooldown() ) );
if ( request.getDesiredCapacity() != null )
- autoScalingGroup.setDesiredCapacity( Numbers.intValue( request.getDesiredCapacity() ) );
+ autoScalingGroup.updateDesiredCapacity( Numbers.intValue( request.getDesiredCapacity() ) );
if ( request.getHealthCheckGracePeriod() != null )
autoScalingGroup.setHealthCheckGracePeriod( Numbers.intValue( request.getHealthCheckGracePeriod() ) );
if ( request.getHealthCheckType() != null )
@@ -1044,20 +1129,22 @@ public TerminateInstanceInAutoScalingGroupResponseType terminateInstanceInAutoSc
TypeMappers.transform( activities.get( 0 ), Activity.class )
);
- if ( Objects.firstNonNull( request.getShouldDecrementDesiredCapacity(), Boolean.FALSE ) ) {
- final String groupArn = instance.getAutoScalingGroup().getArn();
- final Callback<AutoScalingGroup> groupCallback = new Callback<AutoScalingGroup>() {
- @Override
- public void fire( final AutoScalingGroup autoScalingGroup ) {
+ final String groupArn = instance.getAutoScalingGroup().getArn();
+ final Callback<AutoScalingGroup> groupCallback = new Callback<AutoScalingGroup>() {
+ @Override
+ public void fire( final AutoScalingGroup autoScalingGroup ) {
+ if ( Objects.firstNonNull( request.getShouldDecrementDesiredCapacity(), Boolean.FALSE ) ) {
autoScalingGroup.setDesiredCapacity( autoScalingGroup.getDesiredCapacity() - 1 );
+ } else {
+ autoScalingGroup.setScalingRequired( true );
}
- };
+ }
+ };
- autoScalingGroups.update(
- ctx.getUserFullName().asAccountFullName(),
- groupArn,
- groupCallback);
- }
+ autoScalingGroups.update(
+ ctx.getUserFullName().asAccountFullName(),
+ groupArn,
+ groupCallback);
} catch ( AutoScalingMetadataNotFoundException e ) {
throw new InvalidParameterValueException( "Auto scaling instance not found: " + request.getInstanceId( ) );
} catch ( Exception e ) {
@@ -1081,7 +1168,7 @@ private static void setDesiredCapacityWithCooldown( final AutoScalingGroup autoS
final long cooldownMs = TimeUnit.SECONDS.toMillis( Objects.firstNonNull( cooldown, autoScalingGroup.getDefaultCooldown() ) );
if ( !Objects.firstNonNull( honorCooldown, Boolean.FALSE ) ||
( System.currentTimeMillis() - autoScalingGroup.getCapacityTimestamp().getTime() ) > cooldownMs ) {
- autoScalingGroup.setDesiredCapacity( capacity );
+ autoScalingGroup.updateDesiredCapacity( capacity );
autoScalingGroup.setCapacityTimestamp( new Date() );
} else {
throw Exceptions.toUndeclared( new InternalFailureException("Group is in cooldown") );
Oops, something went wrong.

0 comments on commit 255b1f4

Please sign in to comment.