Merge "Revert "Replace SD RPC polling by long RPC call""

This commit is contained in:
Jenkins 2016-05-06 14:05:36 +00:00 committed by Gerrit Code Review
commit 6c893e2e02
2 changed files with 9 additions and 12 deletions

View File

@ -287,8 +287,8 @@ class SoftwareDeployment(signal_responder.SignalResponder):
return sd return sd
def _check_complete(self): def _check_complete(self):
sd = self.rpc_client().check_software_deployment( sd = self.rpc_client().show_software_deployment(
self.context, self.resource_id, self.stack.time_remaining()) self.context, self.resource_id)
status = sd[rpc_api.SOFTWARE_DEPLOYMENT_STATUS] status = sd[rpc_api.SOFTWARE_DEPLOYMENT_STATUS]
if status == SoftwareDeployment.COMPLETE: if status == SoftwareDeployment.COMPLETE:
return True return True

View File

@ -18,8 +18,6 @@ import uuid
import mock import mock
import six import six
from oslo_utils import timeutils
from heat.common import exception as exc from heat.common import exception as exc
from heat.common.i18n import _ from heat.common.i18n import _
from heat.engine.clients.os import nova from heat.engine.clients.os import nova
@ -170,7 +168,6 @@ class SoftwareDeploymentTest(common.HeatTestCase):
stack_user_project_id='65728b74-cfe7-4f17-9c15-11d4f686e591', stack_user_project_id='65728b74-cfe7-4f17-9c15-11d4f686e591',
cache_data=cache_data cache_data=cache_data
) )
self.stack.created_time = timeutils.utcnow()
self.patchobject(nova.NovaClientPlugin, 'get_server', self.patchobject(nova.NovaClientPlugin, 'get_server',
return_value=mock.MagicMock()) return_value=mock.MagicMock())
@ -549,7 +546,7 @@ class SoftwareDeploymentTest(common.HeatTestCase):
def test_check_create_complete(self): def test_check_create_complete(self):
self._create_stack(self.template) self._create_stack(self.template)
sd = self.mock_deployment() sd = self.mock_deployment()
self.rpc_client.check_software_deployment.return_value = sd self.rpc_client.show_software_deployment.return_value = sd
sd['status'] = self.deployment.COMPLETE sd['status'] = self.deployment.COMPLETE
self.assertTrue(self.deployment.check_create_complete(sd)) self.assertTrue(self.deployment.check_create_complete(sd))
@ -563,7 +560,7 @@ class SoftwareDeploymentTest(common.HeatTestCase):
def test_check_update_complete(self): def test_check_update_complete(self):
self._create_stack(self.template) self._create_stack(self.template)
sd = self.mock_deployment() sd = self.mock_deployment()
self.rpc_client.check_software_deployment.return_value = sd self.rpc_client.show_software_deployment.return_value = sd
sd['status'] = self.deployment.COMPLETE sd['status'] = self.deployment.COMPLETE
self.assertTrue(self.deployment.check_update_complete(sd)) self.assertTrue(self.deployment.check_update_complete(sd))
@ -578,7 +575,7 @@ class SoftwareDeploymentTest(common.HeatTestCase):
def test_check_suspend_complete(self): def test_check_suspend_complete(self):
self._create_stack(self.template) self._create_stack(self.template)
sd = self.mock_deployment() sd = self.mock_deployment()
self.rpc_client.check_software_deployment.return_value = sd self.rpc_client.show_software_deployment.return_value = sd
sd['status'] = self.deployment.COMPLETE sd['status'] = self.deployment.COMPLETE
self.assertTrue(self.deployment.check_suspend_complete(sd)) self.assertTrue(self.deployment.check_suspend_complete(sd))
@ -593,7 +590,7 @@ class SoftwareDeploymentTest(common.HeatTestCase):
def test_check_resume_complete(self): def test_check_resume_complete(self):
self._create_stack(self.template) self._create_stack(self.template)
sd = self.mock_deployment() sd = self.mock_deployment()
self.rpc_client.check_software_deployment.return_value = sd self.rpc_client.show_software_deployment.return_value = sd
sd['status'] = self.deployment.COMPLETE sd['status'] = self.deployment.COMPLETE
self.assertTrue(self.deployment.check_resume_complete(sd)) self.assertTrue(self.deployment.check_resume_complete(sd))
@ -611,7 +608,7 @@ class SoftwareDeploymentTest(common.HeatTestCase):
'status': self.deployment.FAILED, 'status': self.deployment.FAILED,
'status_reason': 'something wrong' 'status_reason': 'something wrong'
} }
self.rpc_client.check_software_deployment.return_value = sd self.rpc_client.show_software_deployment.return_value = sd
err = self.assertRaises( err = self.assertRaises(
exc.Error, self.deployment.check_create_complete, sd) exc.Error, self.deployment.check_create_complete, sd)
self.assertEqual( self.assertEqual(
@ -644,7 +641,7 @@ class SoftwareDeploymentTest(common.HeatTestCase):
self.deployment.resource_id = 'c8a19429-7fde-47ea-a42f-40045488226c' self.deployment.resource_id = 'c8a19429-7fde-47ea-a42f-40045488226c'
self.rpc_client.check_software_deployment.return_value = sd self.rpc_client.show_software_deployment.return_value = sd
self.rpc_client.update_software_deployment.return_value = sd self.rpc_client.update_software_deployment.return_value = sd
self.assertEqual(sd, self.deployment.handle_delete()) self.assertEqual(sd, self.deployment.handle_delete())
self.assertEqual({ self.assertEqual({
@ -751,7 +748,7 @@ class SoftwareDeploymentTest(common.HeatTestCase):
derived_sc = self.mock_derived_software_config() derived_sc = self.mock_derived_software_config()
sd = self.mock_deployment() sd = self.mock_deployment()
self.rpc_client.check_software_deployment.return_value = sd self.rpc_client.show_software_deployment.return_value = sd
self.deployment.resource_id = 'c8a19429-7fde-47ea-a42f-40045488226c' self.deployment.resource_id = 'c8a19429-7fde-47ea-a42f-40045488226c'
# first, handle the suspend # first, handle the suspend