Merge "Corrected max secs for concurrent trans retries" into stable/ocata
This commit is contained in:
commit
6ebcfb3fe8
|
@ -102,6 +102,7 @@ class SoftwareConfigService(object):
|
||||||
rs = db_api.resource_get_by_physical_resource_id(cnxt, server_id)
|
rs = db_api.resource_get_by_physical_resource_id(cnxt, server_id)
|
||||||
if not rs:
|
if not rs:
|
||||||
return
|
return
|
||||||
|
cnxt.session.refresh(rs)
|
||||||
deployments = self.metadata_software_deployments(cnxt, server_id)
|
deployments = self.metadata_software_deployments(cnxt, server_id)
|
||||||
md = rs.rsrc_metadata or {}
|
md = rs.rsrc_metadata or {}
|
||||||
md['deployments'] = deployments
|
md['deployments'] = deployments
|
||||||
|
|
|
@ -42,7 +42,7 @@ LOG = logging.getLogger(__name__)
|
||||||
def retry_on_conflict(func):
|
def retry_on_conflict(func):
|
||||||
wrapper = tenacity.retry(
|
wrapper = tenacity.retry(
|
||||||
stop=tenacity.stop_after_attempt(11),
|
stop=tenacity.stop_after_attempt(11),
|
||||||
wait=tenacity.wait_random(max=0.002),
|
wait=tenacity.wait_random(max=2),
|
||||||
retry=tenacity.retry_if_exception_type(
|
retry=tenacity.retry_if_exception_type(
|
||||||
exception.ConcurrentTransaction),
|
exception.ConcurrentTransaction),
|
||||||
reraise=True)
|
reraise=True)
|
||||||
|
|
|
@ -649,6 +649,7 @@ class SoftwareConfigServiceTest(common.HeatTestCase):
|
||||||
'deployments': {'deploy': 'this'}
|
'deployments': {'deploy': 'this'}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
with mock.patch.object(self.ctx.session, 'refresh'):
|
||||||
self.engine.software_config._push_metadata_software_deployments(
|
self.engine.software_config._push_metadata_software_deployments(
|
||||||
self.ctx, '1234', None)
|
self.ctx, '1234', None)
|
||||||
res_upd.assert_called_once_with(
|
res_upd.assert_called_once_with(
|
||||||
|
@ -674,9 +675,11 @@ class SoftwareConfigServiceTest(common.HeatTestCase):
|
||||||
deployments = {'deploy': 'this'}
|
deployments = {'deploy': 'this'}
|
||||||
md_sd.return_value = deployments
|
md_sd.return_value = deployments
|
||||||
|
|
||||||
|
with mock.patch.object(self.ctx.session, 'refresh'):
|
||||||
|
f = self.engine.software_config._push_metadata_software_deployments
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
exception.ConcurrentTransaction,
|
exception.ConcurrentTransaction,
|
||||||
self.engine.software_config._push_metadata_software_deployments,
|
f,
|
||||||
self.ctx,
|
self.ctx,
|
||||||
'1234',
|
'1234',
|
||||||
None)
|
None)
|
||||||
|
@ -709,7 +712,7 @@ class SoftwareConfigServiceTest(common.HeatTestCase):
|
||||||
'original': 'metadata',
|
'original': 'metadata',
|
||||||
'deployments': {'deploy': 'this'}
|
'deployments': {'deploy': 'this'}
|
||||||
}
|
}
|
||||||
|
with mock.patch.object(self.ctx.session, 'refresh'):
|
||||||
self.engine.software_config._push_metadata_software_deployments(
|
self.engine.software_config._push_metadata_software_deployments(
|
||||||
self.ctx, '1234', None)
|
self.ctx, '1234', None)
|
||||||
res_upd.assert_called_once_with(
|
res_upd.assert_called_once_with(
|
||||||
|
@ -748,6 +751,7 @@ class SoftwareConfigServiceTest(common.HeatTestCase):
|
||||||
'deployments': {'deploy': 'this'}
|
'deployments': {'deploy': 'this'}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
with mock.patch.object(self.ctx.session, 'refresh'):
|
||||||
self.engine.software_config._push_metadata_software_deployments(
|
self.engine.software_config._push_metadata_software_deployments(
|
||||||
self.ctx, '1234', 'project1')
|
self.ctx, '1234', 'project1')
|
||||||
res_upd.assert_called_once_with(
|
res_upd.assert_called_once_with(
|
||||||
|
@ -917,6 +921,7 @@ class SoftwareConfigServiceTest(common.HeatTestCase):
|
||||||
zaqar_client.queue.return_value = queue
|
zaqar_client.queue.return_value = queue
|
||||||
queue.pop.return_value = [mock.Mock(body='ok')]
|
queue.pop.return_value = [mock.Mock(body='ok')]
|
||||||
|
|
||||||
|
with mock.patch.object(self.ctx.session, 'refresh'):
|
||||||
deployment = self._create_software_deployment(
|
deployment = self._create_software_deployment(
|
||||||
status='IN_PROGRESS', config_id=config['id'])
|
status='IN_PROGRESS', config_id=config['id'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue