From b0701f6c22e3bda1e588893f015572c0379d0c87 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 17 Jun 2013 17:34:33 -0400 Subject: [PATCH] Support cloud-specific suffixes to server status. 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 | 4 +++- heat/tests/test_instance.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/heat/engine/resources/instance.py b/heat/engine/resources/instance.py index f69d7c6e..4c492ded 100644 --- a/heat/engine/resources/instance.py +++ b/heat/engine/resources/instance.py @@ -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) diff --git a/heat/tests/test_instance.py b/heat/tests/test_instance.py index db1c35c2..17346cba 100644 --- a/heat/tests/test_instance.py +++ b/heat/tests/test_instance.py @@ -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') -- 2.45.2