]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Use scheduler for driving autoscaling task
authorZane Bitter <zbitter@redhat.com>
Tue, 7 May 2013 13:10:10 +0000 (15:10 +0200)
committerZane Bitter <zbitter@redhat.com>
Tue, 7 May 2013 13:10:10 +0000 (15:10 +0200)
For threads that drive autoscaling events, run them to completion using the
task scheduler, to abstract out the sleeping from the main code.

Change-Id: I9b21404a171d92d6edbc59d3099d3ee34f08e22d

heat/engine/resources/autoscaling.py

index 18cbe534adf9c5cfe3a13b68434622e8e589d1d3..8d9a468b628988eed6ccb81546caaf8a62b65dde 100644 (file)
@@ -13,8 +13,6 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import eventlet
-
 from heat.common import exception
 from heat.engine import resource
 from heat.engine import scheduler
@@ -89,8 +87,8 @@ class InstanceGroup(resource.Resource):
         return creator.step()
 
     def _wait_for_activation(self, creator):
-        while not self.check_active(creator):
-            eventlet.sleep(1)
+        if creator is not None:
+            creator.run_to_completion()
 
     def handle_update(self, json_snippet):
         try: