]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
autoscaling: implement DesiredCapacity
authorAngus Salkeld <asalkeld@redhat.com>
Tue, 24 Jul 2012 04:03:24 +0000 (14:03 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Tue, 24 Jul 2012 06:47:45 +0000 (16:47 +1000)
Change-Id: I1403f7857e03795aa4773f9a3f1fc8f082526477
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
heat/engine/autoscaling.py

index 86a51857de6e5ad01781740a535c6f91fef0a093..e599a7f7b7bb2a7de5b71896ae8c738824ab45d1 100644 (file)
@@ -42,8 +42,7 @@ class AutoScalingGroup(Resource):
         'MinSize': {'Required': True,
                     'Type': 'String'},
         'Cooldown': {'Type': 'String'},
-        'DesiredCapacity': {'Type': 'String',
-                            'Implemented': False},
+        'DesiredCapacity': {'Type': 'Integer'},
         'HealthCheckGracePeriod': {'Type': 'Integer',
                                    'Implemented': False},
         'HealthCheckType': {'Type': 'String',
@@ -59,7 +58,13 @@ class AutoScalingGroup(Resource):
         # instance_id is a list of resources
 
     def handle_create(self):
-        self.adjust(int(self.properties['MinSize']),
+
+        if 'DesiredCapacity' in self.properties:
+            num_to_create = int(self.properties['DesiredCapacity'])
+        else:
+            num_to_create = int(self.properties['MinSize'])
+
+        self.adjust(num_to_create,
                     adjustment_type='ExactCapacity')
 
     def handle_update(self):