]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Support cloud-specific suffixes to server status.
authorMonty Taylor <mordred@inaugust.com>
Mon, 17 Jun 2013 21:34:33 +0000 (17:34 -0400)
committerMonty Taylor <mordred@inaugust.com>
Tue, 18 Jun 2013 18:21:45 +0000 (14:21 -0400)
Some clouds, *cough*HP*cough* append extra data to their
status strings. Such as: BUILD(scheduling) or BUILD(networking).
We don't really want to be on the hook for keeping a list of those,
but if we just grab the bit in front of the parenthetical, we should
be able to tell state sensibly, even when people are being weird.

Change-Id: Idaf079d6090db50c9041f398a257b427d63ff48d

heat/engine/resources/instance.py
heat/tests/test_instance.py

index f69d7c6e41d8a146280d4663dfde67cd7cbc5f66..4c492ded3314e9af7dae0535c3c13b7fe4f65b26 100644 (file)
@@ -360,7 +360,9 @@ class Instance(resource.Resource):
             if server.status != 'ACTIVE':
                 server.get()
 
-            if server.status in self._deferred_server_statuses:
+            # Some clouds append extra (STATUS) strings to the status
+            short_server_status = server.status.split('(')[0]
+            if short_server_status in self._deferred_server_statuses:
                 return False
             elif server.status == 'ACTIVE':
                 self._set_ipaddress(server.networks)
index db1c35c26c30df2871a7939c2f5690f01adfb3db..17346cbab3cb403b66673fe31507f69cd97af2af 100644 (file)
@@ -287,6 +287,9 @@ class instancesTest(HeatTestCase):
         scheduler.TaskRunner(instance.create)()
         self.assertEqual(instance.state, instance.CREATE_COMPLETE)
 
+    def test_instance_status_build_spawning(self):
+        self._test_instance_status_not_build_active('BUILD(SPAWNING)')
+
     def test_instance_status_hard_reboot(self):
         self._test_instance_status_not_build_active('HARD_REBOOT')