Correct DSE timeout for several policy_model actions

Correct several potentially longer running actions to use
the longer dse timeout rather than the standard dse time out.

Change-Id: I5202f60005ba9cd356de5d3baba5b7e5b9d0e0c5
Closes-Bug: 1785901
This commit is contained in:
Eric K 2018-08-07 14:29:43 -07:00
parent 502f40a7d2
commit 676b1583d7
2 changed files with 8 additions and 4 deletions

View File

@ -30,6 +30,7 @@ class APIModel(object):
def __init__(self, name, bus=None):
self.name = name
self.dse_long_timeout = cfg.CONF.dse.long_timeout
self.action_retry_timeout = cfg.CONF.dse.execute_action_retry_timeout
self.bus = bus
# Note(thread-safety): blocking function

View File

@ -103,7 +103,8 @@ class PolicyModel(base.APIModel):
policy_metadata = self.invoke_rpc(
base.ENGINE_SERVICE_ID,
'persistent_create_policy_with_rules',
{'policy_rules_obj': library_policy_object})
{'policy_rules_obj': library_policy_object},
timeout=self.dse_long_timeout)
except exception.CongressException as e:
raise webservice.DataModelException.create(e)
@ -117,7 +118,7 @@ class PolicyModel(base.APIModel):
policy_metadata = self.invoke_rpc(
base.ENGINE_SERVICE_ID,
'persistent_create_policy_with_rules',
{'policy_rules_obj': item})
{'policy_rules_obj': item}, timeout=self.dse_long_timeout)
except exception.CongressException as e:
raise webservice.DataModelException.create(e)
@ -169,7 +170,8 @@ class PolicyModel(base.APIModel):
# Note(thread-safety): blocking call
return self.invoke_rpc(base.ENGINE_SERVICE_ID,
'persistent_delete_policy',
{'name_or_id': id_})
{'name_or_id': id_},
timeout=self.dse_long_timeout)
def _get_boolean_param(self, key, params):
if key not in params:
@ -237,7 +239,8 @@ class PolicyModel(base.APIModel):
'action': action,
'action_args': action_args}
# Note(thread-safety): blocking call
self.invoke_rpc(base.ENGINE_SERVICE_ID, 'execute_action', args)
self.invoke_rpc(base.ENGINE_SERVICE_ID, 'execute_action', args,
timeout=self.action_retry_timeout)
except exception.PolicyException as e:
(num, desc) = error_codes.get('execute_error')
raise webservice.DataModelException(num, desc + "::" + str(e))