Skip to content
Browse files

Merge remote-tracking branch 'origin/testing' into team/evac

  • Loading branch information...
2 parents a3d5174 + 9f04e8e commit 2fc28d620feb730bdb460930f90b60a12f602aed @juphoff juphoff committed Feb 25, 2013
Showing with 14,714 additions and 1,501 deletions.
  1. +11 −1 clc/.classpath
  2. +32 −0 clc/eucadmin/bin/euca-describe-instance-types
  3. +32 −0 clc/eucadmin/bin/euca-modify-instance-type-attribute
  4. +102 −0 clc/eucadmin/eucadmin/describeinstancetypes.py
  5. +136 −0 clc/eucadmin/eucadmin/modifyinstancetype.py
  6. +1 −0 clc/eucadmin/setup.py
  7. +6 −6 clc/modules/authentication/src/main/java/com/eucalyptus/auth/crypto/DefaultCryptoProvider.java
  8. +53 −24 ...les/autoscaling-common/src/main/java/com/eucalyptus/autoscaling/common/AutoScalingMessages.groovy
  9. +6 −0 ...dules/autoscaling-common/src/main/java/com/eucalyptus/autoscaling/common/AutoScalingMetadata.java
  10. +2 −18 clc/modules/autoscaling-common/src/main/resources/autoscaling-binding.xml
  11. +435 −42 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/AutoScalingService.java
  12. +35 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/ResourceInUseException.java
  13. +35 −0 ...ules/autoscaling/src/main/java/com/eucalyptus/autoscaling/ScalingActivityInProgressException.java
  14. +1,371 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/ActivityManager.java
  15. +54 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/ActivityStatusCode.java
  16. +247 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/BackoffRunner.java
  17. +116 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/DispatchingClient.java
  18. +33 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/ElbClient.java
  19. +33 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/EucalyptusClient.java
  20. +99 −0 ...autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/PersistenceScalingActivities.java
  21. +76 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/ScalingActivities.java
  22. +215 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/activities/ScalingActivity.java
  23. +15 −10 ...ules/autoscaling/src/main/java/com/eucalyptus/autoscaling/configurations/LaunchConfiguration.java
  24. +38 −0 ...les/autoscaling/src/main/java/com/eucalyptus/autoscaling/configurations/LaunchConfigurations.java
  25. +2 −2 ...ling/src/main/java/com/eucalyptus/autoscaling/configurations/PersistenceLaunchConfigurations.java
  26. +114 −25 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/groups/AutoScalingGroup.java
  27. +23 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/groups/AutoScalingGroups.java
  28. +81 −2 ...les/autoscaling/src/main/java/com/eucalyptus/autoscaling/groups/PersistenceAutoScalingGroups.java
  29. +139 −1 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/groups/TerminationPolicyType.java
  30. +198 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/instances/AutoScalingInstance.java
  31. +136 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/instances/AutoScalingInstances.java
  32. +28 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/instances/HealthStatus.java
  33. +29 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/instances/LifecycleState.java
  34. +172 −0 ...toscaling/src/main/java/com/eucalyptus/autoscaling/instances/PersistenceAutoScalingInstances.java
  35. +6 −1 ...odules/autoscaling/src/main/java/com/eucalyptus/autoscaling/metadata/AbstractOwnedPersistent.java
  36. +80 −91 ...dules/autoscaling/src/main/java/com/eucalyptus/autoscaling/metadata/AbstractOwnedPersistents.java
  37. +114 −0 ...ain/java/com/eucalyptus/autoscaling/metadata/AbstractOwnedPersistentsWithResourceNameSupport.java
  38. +2 −2 ...les/autoscaling/src/main/java/com/eucalyptus/autoscaling/policies/PersistenceScalingPolicies.java
  39. +142 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/tags/AutoScalingGroupTag.java
  40. +139 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/tags/Tag.java
  41. +213 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/tags/TagSupport.java
  42. +51 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/tags/TagSupportDiscovery.java
  43. +232 −0 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/tags/Tags.java
  44. +1 −1 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/ws/AutoScalingQueryBinding.java
  45. +172 −31 clc/modules/autoscaling/src/test/java/com/eucalyptus/autoscaling/AutoScalingBindingTest.groovy
  46. +323 −63 clc/modules/autoscaling/src/test/java/com/eucalyptus/autoscaling/AutoScalingServiceTest.groovy
  47. +783 −0 ...odules/autoscaling/src/test/java/com/eucalyptus/autoscaling/activities/ActivityManagerTest.groovy
  48. +191 −0 clc/modules/autoscaling/src/test/java/com/eucalyptus/autoscaling/activities/BackoffRunnerTest.groovy
  49. +57 −0 clc/modules/autoscaling/src/test/java/com/eucalyptus/autoscaling/activities/TestClients.java
  50. +160 −0 ...ules/autoscaling/src/test/java/com/eucalyptus/autoscaling/groups/TerminationPolicyTypeTest.groovy
  51. +17 −0 clc/modules/cloud/src/main/resources/eucalyptus-model.xml
  52. +24 −0 clc/modules/cloud/src/main/resources/eucalyptus-runtime.xml
  53. +6 −2 clc/modules/cloud/src/main/resources/eucalyptus-services.xml
  54. +25 −55 ...ain/resources/eucalyptus-bootstrap-template.xml → cloud/src/main/resources/eucalyptus-system.xml}
  55. +12 −0 clc/modules/cloud/src/main/resources/eucalyptus-userdata.xml
  56. +55 −18 clc/modules/cloudwatch-common/src/main/java/com/eucalyptus/cloudwatch/CloudWatchMessages.groovy
  57. +31 −16 clc/modules/cloudwatch-common/src/main/resources/cloudwatch-binding.xml
  58. +172 −6 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/CloudWatchService.java
  59. +319 −0 ...ch/src/main/java/com/eucalyptus/cloudwatch/domain/dimension/AbstractPersistentWithDimensions.java
  60. +6 −6 ...alyptus/cloudwatch/domain/{listmetrics/ListMetricDimension.java → dimension/DimensionEntity.java}
  61. +2 −306 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/listmetrics/ListMetric.java
  62. +7 −4 ...ules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/listmetrics/ListMetricManager.java
  63. +16 −15 ...odules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/listmetrics/ListMetricsTest.java
  64. +96 −0 .../src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/GetMetricStatisticsAggregationKey.java
  65. +158 −0 ...modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/MetricDataQueue.java
  66. +190 −0 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/MetricEntity.java
  67. +691 −0 ...les/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/MetricEntityFactory.java
  68. +291 −0 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/MetricManager.java
  69. +146 −0 ...modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/MetricQueueItem.java
  70. +160 −0 ...odules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/MetricStatistics.java
  71. +57 −0 clc/modules/cloudwatch/src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/MetricTest.java
  72. +99 −0 ...dwatch/src/main/java/com/eucalyptus/cloudwatch/domain/metricdata/PutMetricDataAggregationKey.java
  73. +255 −0 clc/modules/cloudwatch/src/test/java/com/eucalyptus/cloudwatch/CloudWatchBindingTest.groovy
  74. +615 −0 clc/modules/cloudwatch/src/test/java/com/eucalyptus/cloudwatch/TestAggregationQueue.java
  75. +1 −1 clc/modules/cluster-manager/src/main/java/com/eucalyptus/blockstorage/Snapshots.java
  76. +1 −1 clc/modules/cluster-manager/src/main/java/com/eucalyptus/blockstorage/Volumes.java
  77. +19 −4 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cloud/run/Allocations.java
  78. +3 −3 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cloud/run/VerifyMetadata.java
  79. +2 −2 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/Cluster.java
  80. +2 −3 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/ClusterEndpoint.java
  81. +3 −3 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/ResourceState.java
  82. +3 −0 ...modules/cluster-manager/src/main/java/com/eucalyptus/cluster/callback/DescribeSensorCallback.java
  83. +2 −2 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/callback/ResourceStateCallback.java
  84. +5 −7 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/callback/VmStateCallback.java
  85. +3 −0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/images/DeviceMapping.java
  86. +2 −2 clc/modules/cluster-manager/src/main/java/com/eucalyptus/images/Emis.java
  87. +2 −0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/images/ImageManager.java
  88. +23 −0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/tags/Filter.java
  89. +117 −9 clc/modules/cluster-manager/src/main/java/com/eucalyptus/tags/FilterSupport.java
  90. +94 −7 clc/modules/cluster-manager/src/main/java/com/eucalyptus/tags/Filters.java
  91. +15 −2 clc/modules/cluster-manager/src/main/java/com/eucalyptus/tags/TagManager.java
  92. +11 −42 ...ptus_storage_AOEManager.c → cluster-manager/src/main/java/com/eucalyptus/vm/ReservedManager.java}
  93. +77 −0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/SpotManager.java
  94. +17 −3 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmBootRecord.java
  95. +123 −7 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmControl.java
  96. +62 −6 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmInstance.java
  97. +29 −0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmInstances.java
  98. +0 −238 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmTypes.java
  99. +207 −0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vmtypes/EphemeralDisk.java
  100. +169 −35 clc/modules/cluster-manager/src/main/java/com/eucalyptus/{vm → vmtypes}/VmType.java
  101. +120 −0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vmtypes/VmTypeMessages.groovy
  102. +547 −0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vmtypes/VmTypes.java
  103. +120 −0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vmtypes/VmTypesManager.java
  104. +14 −46 .../main/java/com/eucalyptus/{util/MetadataStateBootstrapper.java → vpc/PrivateNetworksManager.java}
  105. +2 −2 ...onfiguration/src/main/java/com/eucalyptus/config/{Configuration.java → ConfigurationManager.java}
  106. +42 −4 ...ules/configuration/src/main/java/com/eucalyptus/config/{Properties.java → PropertiesManager.java}
  107. +1 −1 clc/modules/configuration/src/main/resources/configuration-model.xml
  108. +1 −1 clc/modules/configuration/src/main/resources/properties-model.xml
  109. +0 −12 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/DirectStorageInfo.java
  110. +0 −1 clc/modules/dns/src/main/java/com/eucalyptus/cloud/ws/DNSControl.java
  111. +1 −1 clc/modules/euare/src/main/java/com/eucalyptus/auth/euare/EuareService.java
  112. +40 −5 ...ules/loadbalancing-common/src/main/java/com/eucalyptus/loadbalancing/LoadBalancingMessages.groovy
  113. +22 −13 clc/modules/loadbalancing-common/src/main/resources/loadbalancing-binding.xml
  114. +19 −0 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancer.java
  115. +12 −0 ...modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancerBackendInstance.java
  116. +12 −3 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancerListener.java
  117. +27 −1 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancerZone.java
  118. +109 −1 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancingService.java
  119. +148 −0 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/ActivityManager.java
  120. +184 −0 .../loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EucalyptusActivityTasks.java
  121. +28 −0 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandler.java
  122. +55 −0 ...odules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChain.java
  123. +157 −0 ...dules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChains.java
  124. +172 −0 ...oadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/LoadBalancerServoInstance.java
  125. +83 −0 ...balancing/src/main/java/com/eucalyptus/loadbalancing/activities/LoadbalancerInstanceLauncher.java
  126. +53 −0 ...es/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/LoadbalancingEvents.groovy
  127. +0 −1 ...odules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/ws/LoadBalancingQueryBinding.java
  128. +2 −2 ...odules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/ws/LoadBalancingSoapPipeline.java
  129. +106 −0 clc/modules/loadbalancing/src/test/java/com/eucalyptus/loadbalancing/LoadBalancingBindingTest.groovy
  130. +3 −1 clc/modules/module-inc.order
  131. +114 −39 clc/modules/msgs/conf/scripts/setup_membership.groovy
  132. +33 −2 clc/modules/msgs/src/main/java/com/eucalyptus/auth/policy/PolicySpec.java
  133. +129 −77 clc/modules/msgs/src/main/java/com/eucalyptus/binding/BindingCache.java
  134. +3 −0 clc/modules/msgs/src/main/java/com/eucalyptus/bootstrap/OrderedShutdown.java
  135. +5 −3 clc/modules/msgs/src/main/java/com/eucalyptus/component/BasicService.java
  136. +0 −8 clc/modules/msgs/src/main/java/com/eucalyptus/component/ComponentId.java
  137. +15 −18 clc/modules/msgs/src/main/java/com/eucalyptus/component/ComponentMessages.java
  138. +5 −7 clc/modules/msgs/src/main/java/com/eucalyptus/component/Faults.java
  139. +60 −2 clc/modules/msgs/src/main/java/com/eucalyptus/component/auth/SystemCredentials.java
  140. +1 −1 clc/modules/msgs/src/main/java/com/eucalyptus/component/id/Eucalyptus.java
  141. +40 −29 clc/modules/msgs/src/main/java/com/eucalyptus/configurable/AbstractConfigurableProperty.java
  142. +16 −0 clc/modules/msgs/src/main/java/com/eucalyptus/context/ServiceContext.java
  143. +2 −0 clc/modules/msgs/src/main/java/com/eucalyptus/context/ServiceContextManager.java
  144. +10 −0 clc/modules/msgs/src/main/java/com/eucalyptus/entities/Entities.java
  145. +42 −4 clc/modules/msgs/src/main/java/com/eucalyptus/system/Ats.java
  146. +86 −2 clc/modules/msgs/src/main/java/com/eucalyptus/util/CollectionUtils.java
  147. +36 −0 clc/modules/msgs/src/main/java/com/eucalyptus/util/Strings.java
  148. +38 −1 clc/modules/msgs/src/main/java/com/eucalyptus/util/async/Futures.java
  149. +5 −1 clc/modules/msgs/src/main/java/com/eucalyptus/ws/Handlers.java
  150. +66 −0 clc/modules/msgs/src/main/java/com/eucalyptus/ws/handlers/InternalImpersonationHandler.java
  151. +104 −71 clc/modules/msgs/src/main/java/com/eucalyptus/ws/protocol/BaseQueryBinding.java
  152. +11 −4 clc/modules/msgs/src/main/java/edu/ucsb/eucalyptus/msgs/Unimplemented.groovy
  153. +71 −1 clc/modules/msgs/src/main/java/edu/ucsb/eucalyptus/msgs/VmControl.groovy
  154. +1 −1 clc/modules/msgs/src/main/resources/2011-11-01-binding.xml
  155. +1 −1 clc/modules/msgs/src/main/resources/2011-12-01-binding.xml
  156. +1 −1 clc/modules/msgs/src/main/resources/2011-12-15-binding.xml
  157. +1 −1 clc/modules/msgs/src/main/resources/2012-03-01-binding.xml
  158. +1 −1 clc/modules/msgs/src/main/resources/2012-04-01-binding.xml
  159. +1 −1 clc/modules/msgs/src/main/resources/2012-05-01-binding.xml
  160. +1 −1 clc/modules/msgs/src/main/resources/2012-06-01-binding.xml
  161. +1 −1 clc/modules/msgs/src/main/resources/2012-06-15-binding.xml
  162. +1 −1 clc/modules/msgs/src/main/resources/2012-07-20-binding.xml
  163. +1 −1 clc/modules/msgs/src/main/resources/2012-08-15-binding.xml
  164. +1 −1 clc/modules/msgs/src/main/resources/2012-10-01-binding.xml
  165. +46 −0 clc/modules/msgs/src/main/resources/2012-12-01-binding.xml
  166. +472 −0 clc/modules/msgs/src/main/resources/aws-instances-11-11-01.xml
Sorry, we could not display the entire diff because it was too big.
View
12 clc/.classpath
@@ -2,6 +2,10 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="modules/authentication/src/main/java"/>
+ <classpathentry kind="src" path="modules/autoscaling-common/src/main/java"/>
+ <classpathentry kind="src" path="modules/cloudwatch-common/src/main/java"/>
+ <classpathentry kind="src" path="modules/autoscaling/src/main/java"/>
+ <classpathentry kind="src" path="modules/cloudwatch/src/main/java"/>
<classpathentry kind="src" path="modules/cloud/src/main/java"/>
<classpathentry kind="src" path="modules/cluster-manager/src/main/java"/>
<classpathentry kind="src" path="modules/cluster-manager/conf/scripts"/>
@@ -32,6 +36,12 @@
<classpathentry kind="src" path="modules/www/src/main/java"/>
<classpathentry kind="src" path="modules/www/conf/www"/>
<classpathentry kind="src" path="modules/troubleshooting/src/main/java"/>
+ <classpathentry kind="src" path="modules/autoscaling/src/main/java"/>
+ <classpathentry kind="src" path="modules/autoscaling-common/src/main/java"/>
+ <classpathentry kind="src" path="modules/cloudwatch/src/main/java"/>
+ <classpathentry kind="src" path="modules/cloudwatch-common/src/main/java"/>
+ <classpathentry kind="src" path="modules/loadbalancing/src/main/java"/>
+ <classpathentry kind="src" path="modules/loadbalancing-common/src/main/java"/>
<classpathentry kind="con" path="GROOVY_SUPPORT"/>
<classpathentry kind="lib" path="lib/activemq-core-5.4.1.jar"/>
<classpathentry kind="lib" path="lib/ant-1.7.jar"/>
@@ -105,7 +115,7 @@
<classpathentry kind="lib" path="lib/gwt-servlet-deps-2.2.jar"/>
<classpathentry kind="lib" path="lib/gwt-soyc-vis-2.2.jar"/>
<classpathentry kind="lib" path="lib/gwt-user-2.2.jar"/>
- <classpathentry kind="lib" path="lib/ha-jdbc-2.0.16-rc-1-jdk1.6.jar"/>
+ <classpathentry kind="lib" path="lib/ha-jdbc-2.0.16-rc-1-jdk1.6.jar" sourcepath="//git/third-party/ha-jdbc-2.0.16-rc-1"/>
<classpathentry kind="lib" path="lib/hamcrest-all-1.2.jar"/>
<classpathentry kind="lib" path="lib/hibernate-3.5.6-Final.jar"/>
<classpathentry kind="lib" path="lib/infinispan-core-4.2.1.CR4.jar"/>
View
32 clc/eucadmin/bin/euca-describe-instance-types
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+
+# Copyright 2011-2012 Eucalyptus Systems, Inc.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the following
+# conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import eucadmin.describeinstancetypes
+
+if __name__ == "__main__":
+ r = eucadmin.describeinstancetypes.DescribeVmTypes()
+ r.main_cli()
View
32 clc/eucadmin/bin/euca-modify-instance-type-attribute
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+
+# Copyright 2011-2012 Eucalyptus Systems, Inc.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the following
+# conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import eucadmin.modifyinstancetype
+
+if __name__ == "__main__":
+ r = eucadmin.modifyinstancetype.ModifyVmTypeAttribute()
+ r.main_cli()
View
102 clc/eucadmin/eucadmin/describeinstancetypes.py
@@ -0,0 +1,102 @@
+# Copyright 2011-2012 Eucalyptus Systems, Inc.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the following
+# conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from boto.roboto.awsqueryrequest import AWSQueryRequest
+from eucadmin import EucAdmin
+from boto.roboto.param import Param
+import eucadmin
+
+class DescribeVmTypes(AWSQueryRequest):
+ ServicePath = '/services/Eucalyptus'
+ APIVersion = 'eucalyptus'
+ ServiceClass = EucAdmin
+ Description = 'Describe the instance types which are available in the system.'
+ Params = [
+ Param(name='Verbose',
+ short_name='v',
+ long_name='verbose',
+ ptype='boolean',
+ default=False,
+ optional=True,
+ doc='Include extended information about the instance type definition.'),
+ Param(name='Availability',
+ short_name='A',
+ long_name='availability',
+ ptype='boolean',
+ default=False,
+ optional=True,
+ doc='Include information about current instance type in the system.')
+ ]
+
+ Args = [Param(name='VmTypes',
+ long_name='intance type name',
+ ptype='string',
+ cardinality=1,
+ optional=True,
+ doc='[[INSTANCETYPE]...]')]
+
+
+ def __init__(self, **args):
+ AWSQueryRequest.__init__(self, **args)
+ self.list_markers = ['euca:vmTypeDetails']
+ self.item_markers = ['euca:item']
+
+ def get_connection(self, **args):
+ if self.connection is None:
+ args['path'] = self.ServicePath
+ self.connection = self.ServiceClass(**args)
+ return self.connection
+
+ def cli_formatter(self, data):
+# print data
+ vmtypes = getattr(data, 'euca:vmTypeDetails')
+ fmt = 'TYPE\t%-20.20s%-10d%-10d%-10d'
+ detail_fmt = '%s%06d / %06d %s'
+ for vmtype in vmtypes:
+ availability = vmtype.get('euca:availability')
+ if availability:
+ availability_item = availability.get('euca:item')
+ print detail_fmt % ((fmt % (vmtype['euca:name'],
+ int(vmtype['euca:cpu']),
+ int(vmtype['euca:disk']),
+ int(vmtype['euca:memory']))),
+ int(availability_item['euca:available']),
+ int(availability_item['euca:max']),
+ availability_item['euca:zoneName'])
+ else:
+ print fmt % (vmtype['euca:name'],
+ int(vmtype['euca:cpu']),
+ int(vmtype['euca:disk']),
+ int(vmtype['euca:memory']))
+
+
+
+
+ def main(self, **args):
+ return self.send(**args)
+
+ def main_cli(self):
+ eucadmin.print_version_if_necessary()
+ self.do_cli()
View
136 clc/eucadmin/eucadmin/modifyinstancetype.py
@@ -0,0 +1,136 @@
+# Copyright 2011-2012 Eucalyptus Systems, Inc.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the following
+# conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import sys
+import os
+from boto.roboto.awsqueryrequest import AWSQueryRequest
+from boto.roboto.param import Param
+import eucadmin
+
+def encode_disk(param, dict, value):
+ t = value.split('=', 1)
+ if len(t) != 2:
+ print "Options must be of the form KEY=VALUE: %s" % value
+ sys.exit(1)
+ dict['Name'] = t[0]
+ dict['Value'] = t[1]
+def encode_prop(param, dict, value):
+ t = value.split('=', 1)
+ if len(t) != 2:
+ print "Options must be of the form KEY=VALUE: %s" % value
+ sys.exit(1)
+ dict['Name'] = t[0]
+ dict['Value'] = t[1]
+
+def encode_prop_from_file(param, dict, value):
+ t = value.split('=', 1)
+ if len(t) != 2:
+ print "Options must be of the form KEY=VALUE: %s" % value
+ sys.exit(1)
+ dict['Name'] = t[0]
+ #TODO - this should be better integrated with boto.roboto
+ path = t[1]
+ if path == '-':
+ value = sys.stdin.read()
+ else:
+ path = os.path.expanduser(path)
+ path = os.path.expandvars(path)
+ if os.path.isfile(path):
+ fp = open(path)
+ value = fp.read()
+ fp.close()
+ else:
+ print 'Error: Unable to read file: %s' % path
+ sys.exit(1)
+ dict['Value'] = value
+
+def reset_prop(param, dict, value):
+ dict['Name'] = value
+ dict['Reset'] = True
+
+class ModifyPropertyValue(AWSQueryRequest):
+ ServicePath = '/services/Eucalyptus'
+ APIVersion = 'eucalyptus'
+ ServiceClass = EucAdmin
+ Description = 'Modify the definition of an instance type.'
+
+ Params = [Param(name='Disk',
+ short_name='d',
+ long_name='disk',
+ ptype='int',
+ optional=True,
+ doc='Gigabytes of disk for the root file system image.'),
+ Param(name='CPU',
+ short_name='c',
+ long_name='cpu',
+ ptype='int',
+ optional=True,
+ doc='Number of virtual CPUs allocated to this type of instance.'),
+ Param(name='Memory',
+ short_name='m',
+ long_name='memory',
+ ptype='int',
+ optional=True,
+ doc='Megabytes of RAM allocated to this instance type..'),
+ Param(name='EphemeralDisk',
+ short_name='e',
+ long_name='ephemeral-disk',
+ ptype='int',
+ optional=True,
+ encoder=encode_disk,
+ doc='''Modify definition of ephemeral disk in the form ephemeralX=[<device-name>][:<size>[:<format>]], where:
+ \tephemeralX \tX indicates the ephemeral disk index
+ \tdevice-name\tA device string of the form /dev/sd[b-e]
+ \tsize \tSize in gigabytes.
+ \tformat \tFormat of the disk (one of: swap, ext3, none)'''),
+ Param(name='Reset',
+ short_name='r',
+ long_name='reset-to-default',
+ ptype='boolean',
+ optional=True,
+ doc='Reset this instance type back to its default values.')]
+
+ def get_connection(self, **args):
+ if self.connection is None:
+ args['path'] = self.ServicePath
+ self.connection = self.ServiceClass(**args)
+ return self.connection
+
+ def cli_formatter(self, data):
+ print data
+ vmtype = getattr(data, 'euca:vmType')
+ fmt = 'TYPE\t%-10.10s%-10d%-10d%-10d'
+ detail_fmt = '%s%06d / %06d %s'
+ print fmt % (vmtype['euca:name'],
+ int(vmtype['euca:cpu']),
+ int(vmtype['euca:disk']),
+ int(vmtype['euca:memory']))
+
+ def main(self, **args):
+ return self.send(verb='POST', **args)
+
+ def main_cli(self):
+ eucadmin.print_version_if_necessary()
+ self.do_cli()
View
1 clc/eucadmin/setup.py
@@ -72,6 +72,7 @@ def add_paths_to_scripts(self):
"bin/euca-describe-clouds",
"bin/euca-describe-clusters",
"bin/euca-describe-components",
+ "bin/euca-describe-instance-types",
"bin/euca-describe-nodes",
"bin/euca-describe-properties",
"bin/euca-describe-services",
View
12 ...odules/authentication/src/main/java/com/eucalyptus/auth/crypto/DefaultCryptoProvider.java
@@ -91,12 +91,12 @@
import com.eucalyptus.records.EventType;
import com.google.common.primitives.Longs;
-public class DefaultCryptoProvider implements CryptoProvider, CertificateProvider, HmacProvider {
- public static String KEY_ALGORITHM = "RSA";
- public static String KEY_SIGNING_ALGORITHM = "SHA512WithRSA";
- public static int KEY_SIZE = 2048;//TODO:GRZE:RELEASE: configurable
- public static String PROVIDER = "BC";
- private static Logger LOG = Logger.getLogger( DefaultCryptoProvider.class );
+public final class DefaultCryptoProvider implements CryptoProvider, CertificateProvider, HmacProvider {
+ public static String KEY_ALGORITHM = "RSA";
+ private static final String KEY_SIGNING_ALGORITHM = "SHA512WithRSA";
+ private static final int KEY_SIZE = 2048;
+ public static String PROVIDER = "BC";
+ private static Logger LOG = Logger.getLogger( DefaultCryptoProvider.class );
public DefaultCryptoProvider( ) {}
View
77 ...scaling-common/src/main/java/com/eucalyptus/autoscaling/common/AutoScalingMessages.groovy
@@ -67,8 +67,9 @@ public class SuspendProcessesResponseType extends AutoScalingMessage {
public SuspendProcessesResponseType() { }
ResponseMetadata responseMetadata = new ResponseMetadata()
}
-public class AutoScalingNotificationTypes extends AutoScalingMessage {
+public class AutoScalingNotificationTypes extends EucalyptusData {
public AutoScalingNotificationTypes() { }
+ @HttpParameterMapping(parameter="member")
ArrayList<String> member = new ArrayList<String>()
}
public class TerminateInstanceInAutoScalingGroupType extends AutoScalingMessage {
@@ -96,13 +97,11 @@ public class LoadBalancerNames extends EucalyptusData {
if ( names != null ) member.addAll( names )
}
@HttpParameterMapping(parameter="member")
- @HttpEmbedded(multiple=true)
ArrayList<String> member = new ArrayList<String>()
}
public class PolicyNames extends EucalyptusData {
public PolicyNames() { }
@HttpParameterMapping(parameter="member")
- @HttpEmbedded(multiple=true)
ArrayList<String> member = new ArrayList<String>()
}
public class DescribeTerminationPolicyTypesType extends AutoScalingMessage {
@@ -122,12 +121,13 @@ public class DeleteAutoScalingGroupType extends AutoScalingMessage {
public DeleteAutoScalingGroupType() { }
}
public class DescribeNotificationConfigurationsType extends AutoScalingMessage {
+ @HttpEmbedded
AutoScalingGroupNames autoScalingGroupNames
String nextToken
Integer maxRecords
public DescribeNotificationConfigurationsType() { }
}
-public class ScheduledUpdateGroupAction extends AutoScalingMessage {
+public class ScheduledUpdateGroupAction extends EucalyptusData {
String autoScalingGroupName
String scheduledActionName
String scheduledActionARN
@@ -203,10 +203,11 @@ public class DescribeAutoScalingInstancesResponseType extends AutoScalingMessage
public class PutNotificationConfigurationType extends AutoScalingMessage {
String autoScalingGroupName
String topicARN
+ @HttpEmbedded
AutoScalingNotificationTypes notificationTypes
public PutNotificationConfigurationType() { }
}
-public class MetricCollectionTypes extends AutoScalingMessage {
+public class MetricCollectionTypes extends EucalyptusData {
public MetricCollectionTypes() { }
ArrayList<MetricCollectionType> member = new ArrayList<MetricCollectionType>()
}
@@ -261,6 +262,7 @@ public class InstanceMonitoring extends EucalyptusData {
}
public class DescribeScheduledActionsType extends AutoScalingMessage {
String autoScalingGroupName
+ @HttpEmbedded
ScheduledActionNames scheduledActionNames
Date startTime
Date endTime
@@ -270,6 +272,7 @@ public class DescribeScheduledActionsType extends AutoScalingMessage {
}
public class Filter extends EucalyptusData {
String name
+ @HttpEmbedded
Values values
public Filter() { }
}
@@ -281,7 +284,7 @@ public class Alarms extends EucalyptusData {
ArrayList<Alarm> member = new ArrayList<Alarm>()
}
public class DescribeAutoScalingInstancesResult extends EucalyptusData {
- AutoScalingInstances autoScalingInstances
+ AutoScalingInstances autoScalingInstances = new AutoScalingInstances()
String nextToken
public DescribeAutoScalingInstancesResult() { }
}
@@ -304,11 +307,12 @@ public class DescribeMetricCollectionTypesResponseType extends AutoScalingMessag
DescribeMetricCollectionTypesResult describeMetricCollectionTypesResult = new DescribeMetricCollectionTypesResult()
ResponseMetadata responseMetadata = new ResponseMetadata()
}
-public class AutoScalingInstances extends AutoScalingMessage {
+public class AutoScalingInstances extends EucalyptusData {
public AutoScalingInstances() { }
ArrayList<AutoScalingInstanceDetails> member = new ArrayList<AutoScalingInstanceDetails>()
}
public class DescribeTagsType extends AutoScalingMessage {
+ @HttpEmbedded
Filters filters
String nextToken
Integer maxRecords
@@ -345,6 +349,7 @@ public class CreateAutoScalingGroupType extends AutoScalingMessage {
String vpcZoneIdentifier
@HttpEmbedded
TerminationPolicies terminationPolicies
+ @HttpEmbedded
Tags tags
public CreateAutoScalingGroupType() { }
public Collection<String> availabilityZones() {
@@ -359,6 +364,7 @@ public class CreateAutoScalingGroupType extends AutoScalingMessage {
}
public class DisableMetricsCollectionType extends AutoScalingMessage {
String autoScalingGroupName
+ @HttpEmbedded
Metrics metrics
public DisableMetricsCollectionType() { }
}
@@ -371,10 +377,9 @@ public class TerminationPolicies extends EucalyptusData {
if ( terminationPolicies != null ) member.addAll( terminationPolicies )
}
@HttpParameterMapping(parameter="member")
- @HttpEmbedded(multiple=true)
ArrayList<String> member = new ArrayList<String>()
}
-public class NotificationConfiguration extends AutoScalingMessage {
+public class NotificationConfiguration extends EucalyptusData {
String autoScalingGroupName
String topicARN
String notificationType
@@ -392,6 +397,7 @@ public class DescribeNotificationConfigurationsResponseType extends AutoScalingM
}
public class ScheduledActionNames extends EucalyptusData {
public ScheduledActionNames() { }
+ @HttpParameterMapping(parameter="member")
ArrayList<String> member = new ArrayList<String>()
}
public class AvailabilityZones extends EucalyptusData {
@@ -400,7 +406,6 @@ public class AvailabilityZones extends EucalyptusData {
if ( zones != null ) member.addAll( zones )
}
@HttpParameterMapping(parameter="member")
- @HttpEmbedded(multiple=true)
ArrayList<String> member = new ArrayList<String>()
}
public class DescribeScalingActivitiesResult extends EucalyptusData {
@@ -413,6 +418,7 @@ public class DescribeAutoScalingNotificationTypesType extends AutoScalingMessage
}
public class Metrics extends EucalyptusData {
public Metrics() { }
+ @HttpParameterMapping(parameter="member")
ArrayList<String> member = new ArrayList<String>()
}
public class DeleteScheduledActionResponseType extends AutoScalingMessage {
@@ -426,6 +432,7 @@ public class DescribeNotificationConfigurationsResult extends EucalyptusData {
}
public class EnableMetricsCollectionType extends AutoScalingMessage {
String autoScalingGroupName
+ @HttpEmbedded
Metrics metrics
String granularity
public EnableMetricsCollectionType() { }
@@ -459,7 +466,7 @@ public class SecurityGroups extends EucalyptusData {
@HttpParameterMapping(parameter="member")
ArrayList<String> member = new ArrayList<String>()
}
-public class NotificationConfigurations extends AutoScalingMessage {
+public class NotificationConfigurations extends EucalyptusData {
public NotificationConfigurations() { }
ArrayList<NotificationConfiguration> member = new ArrayList<NotificationConfiguration>()
}
@@ -474,10 +481,13 @@ public class DescribeScheduledActionsResponseType extends AutoScalingMessage {
}
public class Filters extends EucalyptusData {
public Filters() { }
+ @HttpEmbedded
+ @HttpParameterMapping(parameter="member")
ArrayList<Filter> member = new ArrayList<Filter>()
}
public class ResumeProcessesType extends AutoScalingMessage {
String autoScalingGroupName
+ @HttpEmbedded
ProcessNames scalingProcesses
public ResumeProcessesType() { }
}
@@ -488,18 +498,20 @@ public class DescribeAdjustmentTypesResponseType extends AutoScalingMessage {
}
public class InstanceIds extends EucalyptusData {
public InstanceIds() { }
+ @HttpParameterMapping(parameter="member")
ArrayList<String> member = new ArrayList<String>()
}
public class SuspendProcessesType extends AutoScalingMessage {
String autoScalingGroupName
+ @HttpEmbedded
ProcessNames scalingProcesses
public SuspendProcessesType() { }
}
-public class LaunchConfigurationsType extends AutoScalingMessage {
+public class LaunchConfigurationsType extends EucalyptusData {
public LaunchConfigurationsType() { }
ArrayList<LaunchConfigurationType> member = new ArrayList<LaunchConfigurationType>()
}
-public class Instances extends AutoScalingMessage {
+public class Instances extends EucalyptusData {
public Instances() { }
ArrayList<Instance> member = new ArrayList<Instance>()
}
@@ -513,12 +525,21 @@ public class DescribeScheduledActionsResult extends EucalyptusData {
public DescribeScheduledActionsResult() { }
}
public class DescribeAutoScalingInstancesType extends AutoScalingMessage {
+ @HttpEmbedded
InstanceIds instanceIds
Integer maxRecords
String nextToken
public DescribeAutoScalingInstancesType() { }
+ public List<String> instanceIds() {
+ List<String> names = Lists.newArrayList()
+ if ( instanceIds != null ) {
+ names = instanceIds.getMember()
+ }
+ return names
+ }
}
public class DeleteTagsType extends AutoScalingMessage {
+ @HttpEmbedded
Tags tags
public DeleteTagsType() { }
}
@@ -536,13 +557,13 @@ public class DescribePoliciesResponseType extends AutoScalingMessage {
DescribePoliciesResult describePoliciesResult = new DescribePoliciesResult()
ResponseMetadata responseMetadata = new ResponseMetadata()
}
-public class Tag extends EucalyptusData {
+public class TagType extends EucalyptusData {
String resourceId
String resourceType
String key
String value
Boolean propagateAtLaunch
- public Tag() { }
+ public TagType() { }
}
public class DescribeTagsResponseType extends AutoScalingMessage {
public DescribeTagsResponseType() { }
@@ -571,13 +592,14 @@ public class ExecutePolicyResponseType extends AutoScalingMessage {
}
public class ActivityIds extends EucalyptusData {
public ActivityIds() { }
+ @HttpParameterMapping(parameter="member")
ArrayList<String> member = new ArrayList<String>()
}
public class MetricGranularityType extends EucalyptusData {
String granularity
public MetricGranularityType() { }
}
-public class AdjustmentTypes extends AutoScalingMessage {
+public class AdjustmentTypes extends EucalyptusData {
public AdjustmentTypes() { }
ArrayList<AdjustmentType> member = new ArrayList<AdjustmentType>()
}
@@ -586,24 +608,25 @@ public class PutScalingPolicyResponseType extends AutoScalingMessage {
PutScalingPolicyResult putScalingPolicyResult = new PutScalingPolicyResult()
ResponseMetadata responseMetadata = new ResponseMetadata()
}
-public class Tags extends AutoScalingMessage {
+public class Tags extends EucalyptusData {
public Tags() { }
@HttpParameterMapping(parameter="member")
@HttpEmbedded(multiple=true)
- ArrayList<Tag> member = new ArrayList<Tag>()
+ ArrayList<TagType> member = new ArrayList<TagType>()
}
public class SetDesiredCapacityResponseType extends AutoScalingMessage {
public SetDesiredCapacityResponseType() { }
ResponseMetadata responseMetadata = new ResponseMetadata()
}
public class DescribeScalingActivitiesType extends AutoScalingMessage {
+ @HttpEmbedded
ActivityIds activityIds
String autoScalingGroupName
Integer maxRecords
String nextToken
public DescribeScalingActivitiesType() { }
}
-public class LaunchConfigurationType extends AutoScalingMessage {
+public class LaunchConfigurationType extends EucalyptusData {
String launchConfigurationName
String launchConfigurationARN
String imageId
@@ -621,7 +644,7 @@ public class LaunchConfigurationType extends AutoScalingMessage {
Boolean ebsOptimized
public LaunchConfigurationType() { }
}
-public class Processes extends AutoScalingMessage {
+public class Processes extends EucalyptusData {
public Processes() { }
ArrayList<ProcessType> member = new ArrayList<ProcessType>()
}
@@ -668,6 +691,7 @@ public class DescribeMetricCollectionTypesResult extends EucalyptusData {
public class BlockDeviceMappingType extends EucalyptusData {
String virtualName
String deviceName
+ @HttpEmbedded
Ebs ebs
public BlockDeviceMappingType() { }
public BlockDeviceMappingType( String deviceName, String virtualName, String snapshotId, Integer volumeSize ) {
@@ -701,7 +725,7 @@ public class DescribePoliciesResult extends EucalyptusData {
String nextToken
public DescribePoliciesResult() { }
}
-public class AutoScalingGroupsType extends AutoScalingMessage {
+public class AutoScalingGroupsType extends EucalyptusData {
public AutoScalingGroupsType() { }
ArrayList<AutoScalingGroupType> member = new ArrayList<AutoScalingGroupType>()
}
@@ -729,7 +753,7 @@ public class DescribeAutoScalingGroupsResponseType extends AutoScalingMessage {
DescribeAutoScalingGroupsResult describeAutoScalingGroupsResult = new DescribeAutoScalingGroupsResult()
ResponseMetadata responseMetadata = new ResponseMetadata()
}
-public class AutoScalingGroupType extends AutoScalingMessage {
+public class AutoScalingGroupType extends EucalyptusData {
String autoScalingGroupName
String autoScalingGroupARN
String launchConfigurationName
@@ -765,7 +789,7 @@ public class DescribeScalingActivitiesResponseType extends AutoScalingMessage {
DescribeScalingActivitiesResult describeScalingActivitiesResult = new DescribeScalingActivitiesResult()
ResponseMetadata responseMetadata = new ResponseMetadata()
}
-public class ScalingPolicyType extends AutoScalingMessage {
+public class ScalingPolicyType extends EucalyptusData {
String autoScalingGroupName
String policyName
Integer scalingAdjustment
@@ -778,10 +802,12 @@ public class ScalingPolicyType extends AutoScalingMessage {
}
public class AutoScalingGroupNames extends EucalyptusData {
public AutoScalingGroupNames() { }
+ @HttpParameterMapping(parameter="member")
ArrayList<String> member = new ArrayList<String>()
}
public class Values extends EucalyptusData {
public Values() { }
+ @HttpParameterMapping(parameter="member")
ArrayList<String> member = new ArrayList<String>()
}
public class Error extends EucalyptusData {
@@ -795,7 +821,7 @@ public class CreateOrUpdateTagsResponseType extends AutoScalingMessage {
public CreateOrUpdateTagsResponseType() { }
ResponseMetadata responseMetadata = new ResponseMetadata()
}
-public class Activities extends AutoScalingMessage {
+public class Activities extends EucalyptusData {
public Activities() { }
ArrayList<Activity> member = new ArrayList<Activity>()
}
@@ -823,6 +849,7 @@ public class ResumeProcessesResponseType extends AutoScalingMessage {
ResponseMetadata responseMetadata = new ResponseMetadata()
}
public class DescribeAutoScalingGroupsType extends AutoScalingMessage {
+ @HttpEmbedded
AutoScalingGroupNames autoScalingGroupNames
String nextToken
Integer maxRecords
@@ -867,11 +894,13 @@ public class DescribeScalingProcessTypesType extends AutoScalingMessage {
public DescribeScalingProcessTypesType() { }
}
public class CreateOrUpdateTagsType extends AutoScalingMessage {
+ @HttpEmbedded
Tags tags
public CreateOrUpdateTagsType() { }
}
public class ProcessNames extends EucalyptusData {
public ProcessNames() { }
+ @HttpParameterMapping(parameter="member")
ArrayList<String> member = new ArrayList<String>()
}
public class DescribeAdjustmentTypesResult extends EucalyptusData {
View
6 ...toscaling-common/src/main/java/com/eucalyptus/autoscaling/common/AutoScalingMetadata.java
@@ -48,4 +48,10 @@
@PolicyResourceType( "scalingpolicy" )
public interface ScalingPolicyMetadata extends AutoScalingMetadataWithResourceName {}
+
+ @PolicyResourceType( "instance" )
+ public interface AutoScalingInstanceMetadata extends AutoScalingMetadata {}
+
+ @PolicyResourceType( "tag" )
+ public interface AutoScalingTagMetadata extends AutoScalingMetadata {}
}
View
20 clc/modules/autoscaling-common/src/main/resources/autoscaling-binding.xml
@@ -473,7 +473,7 @@
<value name="member" type="java.lang.String"/>
</collection>
</mapping>
- <mapping class="com.eucalyptus.autoscaling.common.Tag" abstract="true">
+ <mapping class="com.eucalyptus.autoscaling.common.TagType" abstract="true">
<value name="ResourceId" field="resourceId" usage="optional"/>
<value name="ResourceType" field="resourceType" usage="optional"/>
<value name="Key" field="key" usage="required"/>
@@ -493,13 +493,11 @@
<value name="PropagateAtLaunch" field="propagateAtLaunch" usage="optional"/>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.NotificationConfiguration" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<value name="AutoScalingGroupName" field="autoScalingGroupName" usage="optional"/>
<value name="TopicARN" field="topicARN" usage="optional"/>
<value name="NotificationType" field="notificationType" usage="optional"/>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.AdjustmentTypes" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<collection field="member">
<structure name="member" type="com.eucalyptus.autoscaling.common.AdjustmentType"/>
</collection>
@@ -510,19 +508,16 @@
</collection>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.NotificationConfigurations" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<collection field="member">
<structure name="member" type="com.eucalyptus.autoscaling.common.NotificationConfiguration"/>
</collection>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.LaunchConfigurationsType" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<collection field="member">
<structure name="member" type="com.eucalyptus.autoscaling.common.LaunchConfigurationType"/>
</collection>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.AutoScalingGroupType" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<value name="AutoScalingGroupName" field="autoScalingGroupName" usage="required"/>
<value name="AutoScalingGroupARN" field="autoScalingGroupARN" usage="optional"/>
<value name="LaunchConfigurationName" field="launchConfigurationName" usage="required"/>
@@ -561,7 +556,6 @@
<value name="LaunchConfigurationName" field="launchConfigurationName" usage="required"/>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.Instances" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<collection field="member">
<structure name="member" type="com.eucalyptus.autoscaling.common.Instance"/>
</collection>
@@ -572,13 +566,11 @@
</collection>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.Tags" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<collection field="member">
- <structure name="member" type="com.eucalyptus.autoscaling.common.Tag"/>
+ <structure name="member" type="com.eucalyptus.autoscaling.common.TagType"/>
</collection>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.MetricCollectionTypes" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<collection field="member">
<structure name="member" type="com.eucalyptus.autoscaling.common.MetricCollectionType"/>
</collection>
@@ -614,7 +606,6 @@
<value name="Details" field="details" usage="optional"/>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.ScalingPolicyType" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<value name="AutoScalingGroupName" field="autoScalingGroupName" usage="optional"/>
<value name="PolicyName" field="policyName" usage="optional"/>
<value name="ScalingAdjustment" field="scalingAdjustment" usage="optional"/>
@@ -630,7 +621,6 @@
</collection>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.AutoScalingInstances" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<collection field="member">
<structure name="member" type="com.eucalyptus.autoscaling.common.AutoScalingInstanceDetails"/>
</collection>
@@ -644,7 +634,6 @@
<value name="ProcessName" field="processName" usage="required"/>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.Processes" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<collection field="member">
<structure name="member" type="com.eucalyptus.autoscaling.common.ProcessType"/>
</collection>
@@ -680,7 +669,6 @@
<value name="Metric" field="metric" usage="optional"/>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.ScheduledUpdateGroupAction" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<value name="AutoScalingGroupName" field="autoScalingGroupName" usage="optional"/>
<value name="ScheduledActionName" field="scheduledActionName" usage="optional"/>
<value name="ScheduledActionARN" field="scheduledActionARN" usage="optional"/>
@@ -724,7 +712,6 @@
<value name="Enabled" field="enabled" usage="optional"/>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.AutoScalingGroupsType" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<collection field="member">
<structure name="member" type="com.eucalyptus.autoscaling.common.AutoScalingGroupType"/>
</collection>
@@ -735,7 +722,6 @@
</collection>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.AutoScalingNotificationTypes" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<collection field="member">
<value name="member" type="java.lang.String"/>
</collection>
@@ -746,7 +732,6 @@
</collection>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.Activities" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<collection field="member">
<structure name="member" type="com.eucalyptus.autoscaling.common.Activity"/>
</collection>
@@ -767,7 +752,6 @@
</collection>
</mapping>
<mapping class="com.eucalyptus.autoscaling.common.LaunchConfigurationType" abstract="true">
- <structure map-as="com.eucalyptus.autoscaling.common.AutoScalingMessage"/>
<value name="LaunchConfigurationName" field="launchConfigurationName" usage="required"/>
<value name="LaunchConfigurationARN" field="launchConfigurationARN" usage="optional"/>
<value name="ImageId" field="imageId" usage="required"/>
View
477 clc/modules/autoscaling/src/main/java/com/eucalyptus/autoscaling/AutoScalingService.java
@@ -19,17 +19,32 @@
************************************************************************/
package com.eucalyptus.autoscaling;
+import static com.eucalyptus.autoscaling.common.AutoScalingMetadata.AutoScalingInstanceMetadata;
import static com.eucalyptus.autoscaling.common.AutoScalingResourceName.InvalidResourceNameException;
import static com.eucalyptus.autoscaling.common.AutoScalingMetadata.AutoScalingGroupMetadata;
import static com.eucalyptus.autoscaling.common.AutoScalingMetadata.LaunchConfigurationMetadata;
import static com.eucalyptus.autoscaling.common.AutoScalingResourceName.Type.autoScalingGroup;
+import java.util.Collections;
+import java.util.Date;
import java.util.EnumSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
import org.apache.log4j.Logger;
+import org.hibernate.criterion.Restrictions;
import org.hibernate.exception.ConstraintViolationException;
import com.eucalyptus.auth.AuthQuotaException;
+import com.eucalyptus.auth.Permissions;
+import com.eucalyptus.auth.policy.PolicySpec;
import com.eucalyptus.auth.principal.AccountFullName;
+import com.eucalyptus.auth.principal.UserFullName;
+import com.eucalyptus.autoscaling.activities.ActivityManager;
+import com.eucalyptus.autoscaling.activities.ScalingActivity;
+import com.eucalyptus.autoscaling.common.Activity;
import com.eucalyptus.autoscaling.common.AutoScalingGroupType;
+import com.eucalyptus.autoscaling.common.AutoScalingInstanceDetails;
+import com.eucalyptus.autoscaling.common.AutoScalingMetadata;
import com.eucalyptus.autoscaling.common.AutoScalingMetadatas;
import com.eucalyptus.autoscaling.common.AutoScalingResourceName;
import com.eucalyptus.autoscaling.common.BlockDeviceMappingType;
@@ -83,6 +98,8 @@
import com.eucalyptus.autoscaling.common.EnableMetricsCollectionType;
import com.eucalyptus.autoscaling.common.ExecutePolicyResponseType;
import com.eucalyptus.autoscaling.common.ExecutePolicyType;
+import com.eucalyptus.autoscaling.common.Instance;
+import com.eucalyptus.autoscaling.common.Instances;
import com.eucalyptus.autoscaling.common.LaunchConfigurationType;
import com.eucalyptus.autoscaling.common.PutNotificationConfigurationResponseType;
import com.eucalyptus.autoscaling.common.PutNotificationConfigurationType;
@@ -99,6 +116,9 @@
import com.eucalyptus.autoscaling.common.SetInstanceHealthType;
import com.eucalyptus.autoscaling.common.SuspendProcessesResponseType;
import com.eucalyptus.autoscaling.common.SuspendProcessesType;
+import com.eucalyptus.autoscaling.common.TagDescription;
+import com.eucalyptus.autoscaling.common.TagDescriptionList;
+import com.eucalyptus.autoscaling.common.TagType;
import com.eucalyptus.autoscaling.common.TerminateInstanceInAutoScalingGroupResponseType;
import com.eucalyptus.autoscaling.common.TerminateInstanceInAutoScalingGroupType;
import com.eucalyptus.autoscaling.common.UpdateAutoScalingGroupResponseType;
@@ -111,14 +131,25 @@
import com.eucalyptus.autoscaling.groups.HealthCheckType;
import com.eucalyptus.autoscaling.groups.PersistenceAutoScalingGroups;
import com.eucalyptus.autoscaling.groups.TerminationPolicyType;
+import com.eucalyptus.autoscaling.instances.AutoScalingInstance;
+import com.eucalyptus.autoscaling.instances.AutoScalingInstances;
+import com.eucalyptus.autoscaling.instances.HealthStatus;
+import com.eucalyptus.autoscaling.instances.PersistenceAutoScalingInstances;
import com.eucalyptus.autoscaling.metadata.AutoScalingMetadataException;
import com.eucalyptus.autoscaling.metadata.AutoScalingMetadataNotFoundException;
import com.eucalyptus.autoscaling.policies.AdjustmentType;
import com.eucalyptus.autoscaling.policies.PersistenceScalingPolicies;
import com.eucalyptus.autoscaling.policies.ScalingPolicies;
import com.eucalyptus.autoscaling.policies.ScalingPolicy;
+import com.eucalyptus.autoscaling.tags.AutoScalingGroupTag;
+import com.eucalyptus.autoscaling.tags.Tag;
+import com.eucalyptus.autoscaling.tags.TagSupport;
+import com.eucalyptus.autoscaling.tags.Tags;
+import com.eucalyptus.cloud.util.NoSuchMetadataException;
import com.eucalyptus.context.Context;
import com.eucalyptus.context.Contexts;
+import com.eucalyptus.entities.Entities;
+import com.eucalyptus.entities.TransactionException;
import com.eucalyptus.util.Callback;
import com.eucalyptus.util.EucalyptusCloudException;
import com.eucalyptus.util.Exceptions;
@@ -133,28 +164,45 @@
import com.google.common.base.Predicates;
import com.google.common.base.Supplier;
import com.google.common.collect.Collections2;
+import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Ordering;
import com.google.common.collect.Sets;
public class AutoScalingService {
private static final Logger logger = Logger.getLogger( AutoScalingService.class );
+
+ private static final Set<String> reservedPrefixes =
+ ImmutableSet.<String>builder().add("aws:").add("euca:").build();
+
+ public static long MAX_TAGS_PER_RESOURCE = 10;
+
private final LaunchConfigurations launchConfigurations;
private final AutoScalingGroups autoScalingGroups;
+ private final AutoScalingInstances autoScalingInstances;
private final ScalingPolicies scalingPolicies;
+ private final ActivityManager activityManager;
public AutoScalingService() {
this(
new PersistenceLaunchConfigurations( ),
new PersistenceAutoScalingGroups( ),
- new PersistenceScalingPolicies( ) );
+ new PersistenceAutoScalingInstances( ),
+ new PersistenceScalingPolicies( ),
+ new ActivityManager() );
}
protected AutoScalingService( final LaunchConfigurations launchConfigurations,
final AutoScalingGroups autoScalingGroups,
- final ScalingPolicies scalingPolicies ) {
+ final AutoScalingInstances autoScalingInstances,
+ final ScalingPolicies scalingPolicies,
+ final ActivityManager activityManager ) {
this.launchConfigurations = launchConfigurations;
this.autoScalingGroups = autoScalingGroups;
+ this.autoScalingInstances = autoScalingInstances;
this.scalingPolicies = scalingPolicies;
+ this.activityManager = activityManager;
}
public DescribeAutoScalingGroupsResponseType describeAutoScalingGroups( final DescribeAutoScalingGroupsType request ) throws EucalyptusCloudException {
@@ -173,8 +221,27 @@ public DescribeAutoScalingGroupsResponseType describeAutoScalingGroups( final De
try {
final List<AutoScalingGroupType> results = reply.getDescribeAutoScalingGroupsResult().getAutoScalingGroups().getMember();
- for ( final AutoScalingGroup autoScalingGroup : autoScalingGroups.list( ownerFullName, requestedAndAccessible ) ) {
- results.add( TypeMappers.transform( autoScalingGroup, AutoScalingGroupType.class ) );
+ final List<AutoScalingGroup> groups = autoScalingGroups.list( ownerFullName, requestedAndAccessible );
+ final Map<String,List<Tag>> tagsMap = TagSupport.forResourceClass( AutoScalingGroup.class )
+ .getResourceTagMap( ctx.getUserFullName().asAccountFullName(),
+ Iterables.transform( groups, AutoScalingMetadatas.toDisplayName() ), Predicates.alwaysTrue() );
+
+ for ( final AutoScalingGroup autoScalingGroup : groups ) {
+ final AutoScalingGroupType type = TypeMappers.transform( autoScalingGroup, AutoScalingGroupType.class );
+ final Instances instances = new Instances();
+ Iterables.addAll( instances.getMember(),
+ Iterables.transform(
+ autoScalingInstances.listByGroup( autoScalingGroup ),
+ TypeMappers.lookup( AutoScalingInstance.class, Instance.class ) ) );
+ if ( !instances.getMember().isEmpty() ) {
+ type.setInstances( instances );
+ }
+ final TagDescriptionList tags = new TagDescriptionList();
+ Tags.addFromTags( tags.getMember(), TagDescription.class, tagsMap.get( autoScalingGroup.getAutoScalingGroupName() ) );
+ if ( !tags.getMember().isEmpty() ) {
+ type.setTags( tags );
+ }
+ results.add( type );
}
} catch ( Exception e ) {
handleException( e );
@@ -255,6 +322,20 @@ public CreateAutoScalingGroupResponseType createAutoScalingGroup( final CreateAu
final CreateAutoScalingGroupResponseType reply = request.getReply( );
final Context ctx = Contexts.lookup( );
+
+ if ( request.getTags() != null ) {
+ for ( final TagType tagType : request.getTags().getMember() ) {
+ final String key = tagType.getKey();
+ if ( com.google.common.base.Strings.isNullOrEmpty( key ) || key.trim().length() > 128 || isReserved( key ) ) {
+ throw new InvalidParameterValueException( "Invalid key (max length 128, must not be empty, reserved prefixes "+reservedPrefixes+"): "+key );
+ }
+ }
+
+ if ( request.getTags().getMember().size() >= MAX_TAGS_PER_RESOURCE ) {
+ throw Exceptions.toUndeclared( new LimitExceededException("Tag limit exceeded") );
+ }
+ }
+
final Supplier<AutoScalingGroup> allocator = new Supplier<AutoScalingGroup>( ) {
@Override
public AutoScalingGroup get( ) {
@@ -275,7 +356,19 @@ public AutoScalingGroup get( ) {
.withTerminationPolicyTypes( request.terminationPolicies() == null ? null :
Collections2.filter( Collections2.transform(
request.terminationPolicies(), Enums.valueOfFunction( TerminationPolicyType.class) ),
- Predicates.not( Predicates.isNull() ) ) );
+ Predicates.not( Predicates.isNull() ) ) )
+ .withTags( request.getTags()==null ?
+ null :
+ Iterables.transform( request.getTags().getMember(), TypeMappers.lookup( TagType.class, AutoScalingGroupTag.class ) ) );
+
+ final List<String> referenceErrors = activityManager.validateReferences(
+ ctx.getUserFullName(),
+ request.availabilityZones(),
+ request.loadBalancerNames()
+ );
+ if ( !referenceErrors.isEmpty() ) {
+ throw Exceptions.toUndeclared( new InvalidParameterValueException( "Invalid parameters " + referenceErrors ) );
+ }
//TODO:STEVE: input validation
return builder.persist();
@@ -292,7 +385,7 @@ public AutoScalingGroup get( ) {
try {
RestrictedTypes.allocateUnitlessResource( allocator );
} catch ( Exception e ) {
- handleException( e );
+ handleException( e, true );
}
return reply;
@@ -319,16 +412,47 @@ public DescribeTerminationPolicyTypesResponseType describeTerminationPolicyTypes
return reply;
}
- public DescribeTagsResponseType describeTags(DescribeTagsType request) throws EucalyptusCloudException {
- DescribeTagsResponseType reply = request.getReply( );
+ public DescribeTagsResponseType describeTags( final DescribeTagsType request ) throws EucalyptusCloudException {
+ final DescribeTagsResponseType reply = request.getReply( );
+
+ //TODO:STEVE: MaxRecords / NextToken support for DescribeTags
+ //TODO:STEVE: Filtering support for DescribeTags
+
+ final Context context = Contexts.lookup();
+
+ final Ordering<Tag> ordering = Ordering.natural().onResultOf( Tags.resourceId() )
+ .compound( Ordering.natural().onResultOf( Tags.key() ) )
+ .compound( Ordering.natural().onResultOf( Tags.value() ) );
+ try {
+ final TagDescriptionList tagDescriptions = new TagDescriptionList();
+ for ( final Tag tag : ordering.sortedCopy( Tags.list(
+ context.getUserFullName().asAccountFullName(),
+ Predicates.alwaysTrue(),
+ Restrictions.conjunction(),
+ Collections.<String,String>emptyMap() ) ) ) {
+ if ( Permissions.isAuthorized(
+ PolicySpec.VENDOR_AUTOSCALING,
+ tag.getResourceType(),
+ tag.getKey(),
+ context.getAccount(),
+ PolicySpec.describeAction( PolicySpec.VENDOR_AUTOSCALING, tag.getResourceType() ),
+ context.getUser() ) ) {
+ tagDescriptions.getMember().add( TypeMappers.transform( tag, TagDescription.class ) );
+ }
+ }
+ if ( !tagDescriptions.getMember().isEmpty() ) {
+ reply.getDescribeTagsResult().setTags( tagDescriptions );
+ }
+ } catch ( NoSuchMetadataException e ) {
+ handleException( e );
+ }
+
return reply;
}
public ExecutePolicyResponseType executePolicy(final ExecutePolicyType request) throws EucalyptusCloudException {
final ExecutePolicyResponseType reply = request.getReply( );
- //TODO:STEVE: cooldown support
-
final Context ctx = Contexts.lookup( );
final AccountFullName accountFullName = ctx.getUserFullName( ).asAccountFullName( );
try {
@@ -340,18 +464,23 @@ public ExecutePolicyResponseType executePolicy(final ExecutePolicyType request)
request.getPolicyName() );
} catch ( AutoScalingMetadataNotFoundException e ) {
throw new InvalidParameterValueException( "Scaling policy not found: " + request.getPolicyName() );
- }
-
+ }
+
autoScalingGroups.update( accountFullName, request.getAutoScalingGroupName(), new Callback<AutoScalingGroup>(){
@Override
- public void fire( final AutoScalingGroup autoScalingGroup ) {
- autoScalingGroup.setDesiredCapacity( scalingPolicy.getAdjustmentType().adjustCapacity(
- autoScalingGroup.getDesiredCapacity(), //TODO:STEVE: should be actual capacity ...
- scalingPolicy.getScalingAdjustment(),
- Objects.firstNonNull( scalingPolicy.getMinAdjustmentStep(), 0),
- Objects.firstNonNull( autoScalingGroup.getMinSize(), 0 ),
- Objects.firstNonNull( autoScalingGroup.getMaxSize(), Integer.MAX_VALUE )
- ) );
+ public void fire( final AutoScalingGroup autoScalingGroup ) {
+ failIfScaling( activityManager, autoScalingGroup );
+ setDesiredCapacityWithCooldown(
+ autoScalingGroup,
+ request.getHonorCooldown(),
+ scalingPolicy.getCooldown(),
+ scalingPolicy.getAdjustmentType().adjustCapacity(
+ autoScalingGroup.getDesiredCapacity(),
+ scalingPolicy.getScalingAdjustment(),
+ Objects.firstNonNull( scalingPolicy.getMinAdjustmentStep(), 0 ),
+ Objects.firstNonNull( autoScalingGroup.getMinSize(), 0 ),
+ Objects.firstNonNull( autoScalingGroup.getMaxSize(), Integer.MAX_VALUE )
+ ) );
}
} );
} catch( Exception e ) {
@@ -361,8 +490,56 @@ public void fire( final AutoScalingGroup autoScalingGroup ) {
return reply;
}
- public DeleteTagsResponseType deleteTags(DeleteTagsType request) throws EucalyptusCloudException {
- DeleteTagsResponseType reply = request.getReply( );
+ public DeleteTagsResponseType deleteTags( final DeleteTagsType request ) throws EucalyptusCloudException {
+ final DeleteTagsResponseType reply = request.getReply( );
+
+ final Context context = Contexts.lookup();
+ final OwnerFullName ownerFullName = context.getUserFullName().asAccountFullName();
+ final List<TagType> tagTypes = Objects.firstNonNull( request.getTags().getMember(), Collections.<TagType>emptyList() );
+
+ for ( final TagType tagType : tagTypes ) {
+ final String key = tagType.getKey();
+ if ( com.google.common.base.Strings.isNullOrEmpty( key ) || key.trim().length() > 128 || isReserved( key ) ) {
+ throw new InvalidParameterValueException( "Invalid key (max length 128, must not be empty, reserved prefixes "+reservedPrefixes+"): "+key );
+ }
+ }
+
+ if ( tagTypes.size() > 0 ) {
+ final Predicate<Void> delete = new Predicate<Void>(){
+ @Override
+ public boolean apply( final Void v ) {
+ for ( final TagType tagType : tagTypes ) {
+ try {
+ final TagSupport tagSupport = TagSupport.fromResourceType( tagType.getResourceType() );
+ final AutoScalingMetadata resource =
+ tagSupport.lookup( ownerFullName, tagType.getResourceId() );
+ final Tag example = tagSupport.example( resource, ownerFullName, tagType.getKey(), tagType.getValue() );
+ if ( example != null && Permissions.isAuthorized(
+ PolicySpec.VENDOR_AUTOSCALING,
+ PolicySpec.AUTOSCALING_RESOURCE_TAG,
+ example.getResourceType() + ":" + example.getResourceId() + ":" + example.getKey(),
+ context.getAccount(),
+ PolicySpec.AUTOSCALING_DELETETAGS,
+ context.getUser() ) ) {
+ Tags.delete( example );
+ }
+ } catch ( NoSuchMetadataException e ) {
+ logger.debug( e, e );
+ } catch ( TransactionException e ) {
+ throw Exceptions.toUndeclared(e);
+ }
+ }
+ return true;
+ }
+ };
+
+ try {
+ Entities.asTransaction( Tag.class, delete ).apply( null );
+ } catch ( Exception e ) {
+ handleException( e );
+ }
+ }
+
return reply;
}
@@ -428,7 +605,7 @@ public ScalingPolicy get( ) {
final ScalingPolicy scalingPolicy = RestrictedTypes.allocateUnitlessResource( allocator );
reply.getPutScalingPolicyResult().setPolicyARN( scalingPolicy.getArn() );
} catch ( Exception exception ) {
- handleException( exception );
+ handleException( exception, true );
}
} catch ( Exception e ) {
@@ -472,8 +649,35 @@ public DeleteScheduledActionResponseType deleteScheduledAction(DeleteScheduledAc
return reply;
}
- public SetInstanceHealthResponseType setInstanceHealth(SetInstanceHealthType request) throws EucalyptusCloudException {
- SetInstanceHealthResponseType reply = request.getReply( );
+ public SetInstanceHealthResponseType setInstanceHealth(final SetInstanceHealthType request) throws EucalyptusCloudException {
+ final SetInstanceHealthResponseType reply = request.getReply( );
+
+ final Context ctx = Contexts.lookup( );
+ final OwnerFullName ownerFullName = ctx.hasAdministrativePrivileges( ) ?
+ null :
+ ctx.getUserFullName( ).asAccountFullName( );
+
+ try {
+ final Callback<AutoScalingInstance> instanceUpdateCallback = new Callback<AutoScalingInstance>() {
+ @Override
+ public void fire( final AutoScalingInstance instance ) {
+ if ( RestrictedTypes.filterPrivileged().apply( instance ) ) {
+ if ( !Objects.firstNonNull( request.getShouldRespectGracePeriod(), Boolean.FALSE ) ||
+ instance.healthStatusGracePeriodExpired() ) {
+ instance.setHealthStatus( Enums.valueOfFunction( HealthStatus.class ).apply( request.getHealthStatus( ) ) );
+ }
+ } else {
+ throw Exceptions.toUndeclared( new AutoScalingMetadataNotFoundException("Instance not found") );
+ }
+ }
+ };
+ autoScalingInstances.update( ownerFullName, request.getInstanceId(), instanceUpdateCallback );
+ } catch ( AutoScalingMetadataNotFoundException e ) {
+ throw new InvalidParameterValueException( "Auto scaling instance not found: " + request.getInstanceId( ) );
+ } catch ( Exception e ) {
+ handleException( e );
+ }
+
return reply;
}
@@ -482,8 +686,62 @@ public DescribeAutoScalingNotificationTypesResponseType describeAutoScalingNotif
return reply;
}
- public CreateOrUpdateTagsResponseType createOrUpdateTags(CreateOrUpdateTagsType request) throws EucalyptusCloudException {
- CreateOrUpdateTagsResponseType reply = request.getReply( );
+ public CreateOrUpdateTagsResponseType createOrUpdateTags( final CreateOrUpdateTagsType request ) throws EucalyptusCloudException {
+ final CreateOrUpdateTagsResponseType reply = request.getReply( );
+
+ final Context context = Contexts.lookup();
+ final UserFullName ownerFullName = context.getUserFullName();
+ final AccountFullName accountFullName = ownerFullName.asAccountFullName();
+
+ for ( final TagType tagType : request.getTags().getMember() ) {
+ final String key = tagType.getKey();
+ final String value = com.google.common.base.Strings.nullToEmpty( tagType.getValue() ).trim();
+
+ if ( com.google.common.base.Strings.isNullOrEmpty( key ) || key.trim().length() > 128 || isReserved( key ) ) {
+ throw new InvalidParameterValueException( "Invalid key (max length 128, must not be empty, reserved prefixes "+reservedPrefixes+"): "+key );
+ }
+ if ( value.length() > 256 || isReserved( key ) ) {
+ throw new InvalidParameterValueException( "Invalid value (max length 256, reserved prefixes "+reservedPrefixes+"): "+value );
+ }
+ }
+
+ if ( request.getTags().getMember().size() > 0 ) {
+ final Predicate<Void> creator = new Predicate<Void>(){
+ @Override
+ 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() ) );
+ }
+
+ 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()+"'") );
+ }
+
+ 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 );
+ }
+ return true;
+ } catch ( Exception e ) {
+ throw Exceptions.toUndeclared( e );
+ }
+ }
+ };
+
+ try {
+ Entities.asTransaction( Tag.class, creator ).apply( null );
+ } catch ( Exception e ) {
+ handleException( e, true );
+ }
+ }
+
return reply;
}
@@ -492,8 +750,30 @@ public SuspendProcessesResponseType suspendProcesses(SuspendProcessesType reques
return reply;
}
- public DescribeAutoScalingInstancesResponseType describeAutoScalingInstances(DescribeAutoScalingInstancesType request) throws EucalyptusCloudException {
- DescribeAutoScalingInstancesResponseType reply = request.getReply( );
+ public DescribeAutoScalingInstancesResponseType describeAutoScalingInstances( final DescribeAutoScalingInstancesType request ) throws EucalyptusCloudException {
+ final DescribeAutoScalingInstancesResponseType reply = request.getReply( );
+
+ //TODO:STEVE: MaxRecords / NextToken support for DescribeAutoScalingInstances
+
+ final Context ctx = Contexts.lookup( );
+ final boolean showAll = request.instanceIds().remove( "verbose" );
+ final OwnerFullName ownerFullName = ctx.hasAdministrativePrivileges( ) && showAll ?
+ null :
+ ctx.getUserFullName( ).asAccountFullName( );
+
+ final Predicate<AutoScalingInstanceMetadata> requestedAndAccessible =
+ AutoScalingMetadatas.filterPrivilegesById( request.instanceIds() );
+
+ try {
+ final List<AutoScalingInstanceDetails> results =
+ reply.getDescribeAutoScalingInstancesResult().getAutoScalingInstances().getMember();
+ for ( final AutoScalingInstance autoScalingInstance : autoScalingInstances.list( ownerFullName, requestedAndAccessible ) ) {
+ results.add( TypeMappers.transform( autoScalingInstance, AutoScalingInstanceDetails.class ) );
+ }
+ } catch ( Exception e ) {
+ handleException( e );
+ }
+
return reply;
}
@@ -525,7 +805,17 @@ public LaunchConfiguration get( ) {
blockDeviceMappingType.getEbs() != null ? Numbers.intValue( blockDeviceMappingType.getEbs().getVolumeSize() ) : null );
}
}
-
+
+ final List<String> referenceErrors = activityManager.validateReferences(
+ ctx.getUserFullName(),
+ Iterables.filter( Lists.newArrayList( request.getImageId(), request.getKernelId(), request.getRamdiskId() ), Predicates.notNull() ),
+ request.getKeyName(),
+ request.getSecurityGroups() == null ? Collections.<String>emptyList() : request.getSecurityGroups().getMember()
+ );
+ if ( !referenceErrors.isEmpty() ) {
+ throw Exceptions.toUndeclared( new InvalidParameterValueException( "Invalid parameters " + referenceErrors ) );
+ }
+
//TODO:STEVE: input validation
return builder.persist();
} catch ( Exception ex ) {
@@ -537,21 +827,35 @@ public LaunchConfiguration get( ) {
try {
RestrictedTypes.allocateUnitlessResource( allocator );
} catch ( Exception e ) {
- handleException( e );
+ handleException( e, true );
}
return reply;
}
public DeleteAutoScalingGroupResponseType deleteAutoScalingGroup( final DeleteAutoScalingGroupType request ) throws EucalyptusCloudException {
final DeleteAutoScalingGroupResponseType reply = request.getReply( );
-
+
final Context ctx = Contexts.lookup( );
try {
final AutoScalingGroup autoScalingGroup = autoScalingGroups.lookup(
ctx.getUserFullName( ).asAccountFullName( ),
request.getAutoScalingGroupName() );
if ( RestrictedTypes.filterPrivileged().apply( autoScalingGroup ) ) {
+ // Terminate instances first if requested (but don't wait for success ...)
+ if ( Objects.firstNonNull( request.getForceDelete(), Boolean.FALSE ) ) {
+ final List<AutoScalingInstance> instances = autoScalingInstances.listByGroup( autoScalingGroup );
+ if ( !instances.isEmpty() ) {
+ final List<ScalingActivity> activities =
+ activityManager.terminateInstances( autoScalingGroup, instances );
+ if ( activities==null || activities.isEmpty() ) {
+ throw new ScalingActivityInProgressException("Scaling activity in progress");
+ }
+ autoScalingInstances.deleteByGroup( autoScalingGroup );
+ }
+ } else {
+ failIfScaling( activityManager, autoScalingGroup );
+ }
autoScalingGroups.delete( autoScalingGroup );
} // else treat this as though the group does not exist
} catch ( AutoScalingMetadataNotFoundException e ) {
@@ -579,7 +883,7 @@ 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( Sets.newHashSet( request.availabilityZones() ) );
+ autoScalingGroup.setAvailabilityZones( Lists.newArrayList( Sets.newLinkedHashSet( request.availabilityZones() ) ) );
if ( request.getDefaultCooldown() != null )
autoScalingGroup.setDefaultCooldown( Numbers.intValue( request.getDefaultCooldown() ) );
if ( request.getDesiredCapacity() != null )
@@ -601,18 +905,28 @@ public void fire( final AutoScalingGroup autoScalingGroup ) {
if ( request.getMinSize() != null )
autoScalingGroup.setMinSize( Numbers.intValue( request.getMinSize() ) );
if ( request.terminationPolicies() != null && !request.terminationPolicies().isEmpty() )
- autoScalingGroup.setTerminationPolicies( Sets.newHashSet( Iterables.filter( Iterables.transform(
- request.terminationPolicies(), Enums.valueOfFunction( TerminationPolicyType.class ) ),
- Predicates.not( Predicates.isNull() ) ) ) );
+ autoScalingGroup.setTerminationPolicies( Lists.newArrayList(
+ Sets.newLinkedHashSet( Iterables.filter(
+ Iterables.transform( request.terminationPolicies(), Enums.valueOfFunction( TerminationPolicyType.class ) ),
+ Predicates.not( Predicates.isNull() ) ) ) ) );
//TODO:STEVE: something for VPC zone identifier or placement group?
+
+ final List<String> referenceErrors = activityManager.validateReferences(
+ autoScalingGroup.getOwner(),
+ autoScalingGroup.getAvailabilityZones(),
+ Collections.<String>emptyList() // load balancer names cannot be updated
+ );
+ if ( !referenceErrors.isEmpty() ) {
+ throw Exceptions.toUndeclared( new InvalidParameterValueException( "Invalid parameters " + referenceErrors ) );
+ }
}
}
};
autoScalingGroups.update(
accountFullName,
request.getAutoScalingGroupName(),
- groupCallback);
+ groupCallback );
} catch ( AutoScalingMetadataNotFoundException e ) {
throw new InvalidParameterValueException( "Auto scaling group not found: " + request.getAutoScalingGroupName() );
} catch ( Exception e ) {
@@ -683,11 +997,16 @@ public SetDesiredCapacityResponseType setDesiredCapacity( final SetDesiredCapaci
@Override
public void fire( final AutoScalingGroup autoScalingGroup ) {
if ( RestrictedTypes.filterPrivileged().apply( autoScalingGroup ) ) {
- autoScalingGroup.setDesiredCapacity( Numbers.intValue( request.getDesiredCapacity() ) );
+ failIfScaling( activityManager, autoScalingGroup );
+ setDesiredCapacityWithCooldown(
+ autoScalingGroup,
+ request.getHonorCooldown(),
+ null,
+ Numbers.intValue( request.getDesiredCapacity() ) );
}
}
};
-
+
autoScalingGroups.update(
ctx.getUserFullName().asAccountFullName(),
request.getAutoScalingGroupName(),
@@ -701,12 +1020,84 @@ public void fire( final AutoScalingGroup autoScalingGroup ) {
return reply;
}
- public TerminateInstanceInAutoScalingGroupResponseType terminateInstanceInAutoScalingGroup(TerminateInstanceInAutoScalingGroupType request) throws EucalyptusCloudException {
- TerminateInstanceInAutoScalingGroupResponseType reply = request.getReply( );
+ public TerminateInstanceInAutoScalingGroupResponseType terminateInstanceInAutoScalingGroup( final TerminateInstanceInAutoScalingGroupType request ) throws EucalyptusCloudException {
+ final TerminateInstanceInAutoScalingGroupResponseType reply = request.getReply( );
+
+ final Context ctx = Contexts.lookup( );
+ final OwnerFullName ownerFullName = ctx.hasAdministrativePrivileges( ) ?
+ null :
+ ctx.getUserFullName( ).asAccountFullName( );
+
+ try {
+ final AutoScalingInstance instance =
+ autoScalingInstances.lookup( ownerFullName, request.getInstanceId() );
+ if ( !RestrictedTypes.filterPrivileged().apply( instance ) ) {
+ throw new AutoScalingMetadataNotFoundException("Instance not found");
+ }
+
+ final List<ScalingActivity> activities =
+ activityManager.terminateInstances( instance.getAutoScalingGroup(), Lists.newArrayList( instance ) );
+ if ( activities == null || activities.isEmpty() ) {
+ throw new ScalingActivityInProgressException("Scaling activity in progress");
+ }
+ reply.getTerminateInstanceInAutoScalingGroupResult().setActivity(
+ 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 ) {
+ autoScalingGroup.setDesiredCapacity( autoScalingGroup.getDesiredCapacity() - 1 );
+ }
+ };
+
+ autoScalingGroups.update(
+ ctx.getUserFullName().asAccountFullName(),
+ groupArn,
+ groupCallback);
+ }
+ } catch ( AutoScalingMetadataNotFoundException e ) {
+ throw new InvalidParameterValueException( "Auto scaling instance not found: " + request.getInstanceId( ) );
+ } catch ( Exception e ) {
+ handleException( e );
+ }
+
return reply;
}
+ private static void failIfScaling( final ActivityManager activityManager,
+ final AutoScalingGroup group ) {
+ if ( activityManager.scalingInProgress( group ) ) {
+ throw Exceptions.toUndeclared( new ScalingActivityInProgressException("Scaling activity in progress") );
+ }
+ }
+
+ private static void setDesiredCapacityWithCooldown( final AutoScalingGroup autoScalingGroup,
+ final Boolean honorCooldown,
+ final Integer cooldown,
+ final int capacity ) {
+ 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.setCapacityTimestamp( new Date() );
+ } else {
+ throw Exceptions.toUndeclared( new InternalFailureException("Group is in cooldown") );
+ }
+ }
+
+ private static boolean isReserved( final String text ) {
+ return Iterables.any( reservedPrefixes, Strings.isPrefixOf( text ) );
+ }
+
private static void handleException( final Exception e ) throws AutoScalingException {
+ handleException( e, false );
+ }
+
+ private static void handleException( final Exception e,
+ final boolean isCreate ) throws AutoScalingException {
final AutoScalingException cause = Exceptions.findCause( e, AutoScalingException.class );
if ( cause != null ) {
throw cause;
@@ -720,7 +1111,9 @@ private static void handleException( final Exception e ) throws AutoScalingExcep
final ConstraintViolationException constraintViolationException =
Exceptions.findCause( e, ConstraintViolationException.class );
if ( constraintViolationException != null ) {
- throw new AlreadyExistsException( "Resource already exists" );