Merge "Miscellaneous fixes"
This commit is contained in:
commit
baa94635f6
|
@ -433,10 +433,6 @@ class Action(object):
|
||||||
status = self.CANCELLED
|
status = self.CANCELLED
|
||||||
ao.Action.mark_cancelled(self.context, self.id, timestamp)
|
ao.Action.mark_cancelled(self.context, self.id, timestamp)
|
||||||
|
|
||||||
elif result == self.RES_LIFECYCLE_COMPLETE:
|
|
||||||
status = self.SUCCEEDED
|
|
||||||
ao.Action.mark_ready(self.context, self.id, timestamp)
|
|
||||||
|
|
||||||
else: # result == self.RES_RETRY:
|
else: # result == self.RES_RETRY:
|
||||||
retries = self.data.get('retries', 0)
|
retries = self.data.get('retries', 0)
|
||||||
# Action failed at the moment, but can be retried
|
# Action failed at the moment, but can be retried
|
||||||
|
|
|
@ -257,13 +257,16 @@ class NodeAction(base.Action):
|
||||||
if not res:
|
if not res:
|
||||||
return self.RES_RETRY, 'Failed in locking cluster'
|
return self.RES_RETRY, 'Failed in locking cluster'
|
||||||
|
|
||||||
self.policy_check(self.entity.cluster_id, 'BEFORE')
|
try:
|
||||||
if self.data['status'] != pb.CHECK_OK:
|
self.policy_check(self.entity.cluster_id, 'BEFORE')
|
||||||
# Don't emit message since policy_check should have done it
|
finally:
|
||||||
senlin_lock.cluster_lock_release(saved_cluster_id, self.id,
|
if self.data['status'] != pb.CHECK_OK:
|
||||||
senlin_lock.NODE_SCOPE)
|
# Don't emit message since policy_check should have
|
||||||
return self.RES_ERROR, ('Policy check: ' +
|
# done it
|
||||||
self.data['reason'])
|
senlin_lock.cluster_lock_release(
|
||||||
|
saved_cluster_id, self.id, senlin_lock.NODE_SCOPE)
|
||||||
|
return self.RES_ERROR, ('Policy check: ' +
|
||||||
|
self.data['reason'])
|
||||||
elif self.cause == consts.CAUSE_DERIVED_LCH:
|
elif self.cause == consts.CAUSE_DERIVED_LCH:
|
||||||
self.policy_check(self.entity.cluster_id, 'BEFORE')
|
self.policy_check(self.entity.cluster_id, 'BEFORE')
|
||||||
|
|
||||||
|
|
|
@ -136,9 +136,9 @@ def node_lock_acquire(context, node_id, action_id, engine=None,
|
||||||
ao.Action.mark_failed(context, action.id, time.time(), reason)
|
ao.Action.mark_failed(context, action.id, time.time(), reason)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
LOG.error('Node is already locked by action %(old)s, '
|
LOG.warning('Node is already locked by action %(old)s, '
|
||||||
'action %(new)s failed grabbing the lock',
|
'action %(new)s failed grabbing the lock',
|
||||||
{'old': owner, 'new': action_id})
|
{'old': owner, 'new': action_id})
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -704,12 +704,6 @@ class ActionBaseTest(base.SenlinTestCase):
|
||||||
mark_cancel.assert_called_once_with(action.context, 'FAKE_ID',
|
mark_cancel.assert_called_once_with(action.context, 'FAKE_ID',
|
||||||
mock.ANY)
|
mock.ANY)
|
||||||
|
|
||||||
mark_fail.reset_mock()
|
|
||||||
action.set_status(action.RES_LIFECYCLE_COMPLETE, 'LIFECYCLE COMPLETE')
|
|
||||||
self.assertEqual(action.SUCCEEDED, action.status)
|
|
||||||
self.assertEqual('LIFECYCLE COMPLETE', action.status_reason)
|
|
||||||
mark_ready.assert_called_once_with(action.context, 'FAKE_ID', mock.ANY)
|
|
||||||
|
|
||||||
mark_fail.reset_mock()
|
mark_fail.reset_mock()
|
||||||
action.set_status(action.RES_RETRY, 'BUSY')
|
action.set_status(action.RES_RETRY, 'BUSY')
|
||||||
self.assertEqual(action.READY, action.status)
|
self.assertEqual(action.READY, action.status)
|
||||||
|
|
Loading…
Reference in New Issue