]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Separate public/private autoscaling adjust() APIs
authorZane Bitter <zbitter@redhat.com>
Mon, 4 Mar 2013 10:31:27 +0000 (11:31 +0100)
committerZane Bitter <zbitter@redhat.com>
Mon, 4 Mar 2013 10:35:36 +0000 (11:35 +0100)
Internal uses of adjust() have slightly different needs.

Change-Id: Ibb85425f08b7b2d78be2d9ef5c8a9f464b7eead1
Signed-off-by: Zane Bitter <zbitter@redhat.com>
heat/engine/resources/autoscaling.py

index eaaf97972c1ec130c98b42ec7bc8d14d21d88ce5..ed1db3368759c38961a4d2b74eb9bad0a130c795 100644 (file)
@@ -253,8 +253,7 @@ class AutoScalingGroup(InstanceGroup, CooldownMixin):
         else:
             num_to_create = int(self.properties['MinSize'])
 
-        self.adjust(num_to_create, adjustment_type='ExactCapacity',
-                    raise_on_error=True)
+        self._adjust(num_to_create)
 
     def handle_update(self, json_snippet):
         try:
@@ -298,13 +297,16 @@ class AutoScalingGroup(InstanceGroup, CooldownMixin):
                         new_capacity = int(self.properties['DesiredCapacity'])
 
             if new_capacity is not None:
-                self.adjust(new_capacity, adjustment_type='ExactCapacity',
-                            raise_on_error=True)
+                self._adjust(new_capacity)
 
         return self.UPDATE_COMPLETE
 
-    def adjust(self, adjustment, adjustment_type='ChangeInCapacity',
-               raise_on_error=False):
+    def adjust(self, adjustment, adjustment_type='ChangeInCapacity'):
+        self._adjust(adjustment, adjustment_type, False)
+
+    def _adjust(self, adjustment, adjustment_type='ExactCapacity',
+                raise_on_error=True):
+
         if self._cooldown_inprogress():
             logger.info("%s NOT performing scaling adjustment, cooldown %s" %
                         (self.name, self.properties['Cooldown']))