Operation Engine: Remove the triggered state
In ScheduledOperationState, there are two states: 'triggered' and 'running'. The two states can be merged into one. Change-Id: I0c8ffdfb9245dd1273af374b1cf38891c9743208
This commit is contained in:
parent
9621772092
commit
fcf69d34b4
|
@ -82,7 +82,6 @@ RESOURCE_STATUS_UNDEFINED = 'undefined'
|
|||
# scheduled operation state
|
||||
OPERATION_STATE_INIT = 'init'
|
||||
OPERATION_STATE_REGISTERED = 'registered'
|
||||
OPERATION_STATE_TRIGGERED = 'triggered'
|
||||
OPERATION_STATE_RUNNING = 'running'
|
||||
OPERATION_STATE_DELETED = 'deleted'
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class GreenThreadExecutor(base.BaseExecutor):
|
|||
end_time_for_run = expect_start_time + timedelta(seconds=window_time)
|
||||
ret = self._update_operation_state(
|
||||
operation_id,
|
||||
{'state': constants.OPERATION_STATE_TRIGGERED,
|
||||
{'state': constants.OPERATION_STATE_RUNNING,
|
||||
'end_time_for_run': end_time_for_run})
|
||||
if not ret:
|
||||
self._operation_thread_map.pop(operation_id, None)
|
||||
|
@ -132,10 +132,6 @@ class GreenThreadExecutor(base.BaseExecutor):
|
|||
|
||||
def _run_operation(self, operation_id, param):
|
||||
|
||||
self._update_operation_state(
|
||||
operation_id,
|
||||
{'state': constants.OPERATION_STATE_RUNNING})
|
||||
|
||||
try:
|
||||
try:
|
||||
operation = objects.ScheduledOperation.get_by_id(
|
||||
|
|
|
@ -43,7 +43,7 @@ class ScheduledOperationExecutor(base.BaseExecutor):
|
|||
end_time_for_run = expect_start_time + timedelta(seconds=window_time)
|
||||
ret = self._update_operation_state(
|
||||
operation_id,
|
||||
{'state': constants.OPERATION_STATE_TRIGGERED,
|
||||
{'state': constants.OPERATION_STATE_RUNNING,
|
||||
'end_time_for_run': end_time_for_run})
|
||||
if not ret:
|
||||
return
|
||||
|
@ -75,10 +75,6 @@ class ScheduledOperationExecutor(base.BaseExecutor):
|
|||
|
||||
def _run_operation(self, operation_id, param):
|
||||
|
||||
self._update_operation_state(
|
||||
operation_id,
|
||||
{'state': constants.OPERATION_STATE_RUNNING})
|
||||
|
||||
try:
|
||||
check_item = [self._CHECK_ITEMS['is_canceled']]
|
||||
if self._check_operation(operation_id, check_item):
|
||||
|
|
|
@ -124,12 +124,10 @@ class OperationEngineManager(manager.Manager):
|
|||
marker = None
|
||||
filters = {"service_id": self._service_id,
|
||||
"state": [constants.OPERATION_STATE_REGISTERED,
|
||||
constants.OPERATION_STATE_TRIGGERED,
|
||||
constants.OPERATION_STATE_RUNNING]}
|
||||
columns_to_join = ['operation']
|
||||
ctxt = karbor_context.get_admin_context()
|
||||
resume_states = [constants.OPERATION_STATE_TRIGGERED,
|
||||
constants.OPERATION_STATE_RUNNING]
|
||||
resume_states = [constants.OPERATION_STATE_RUNNING, ]
|
||||
while True:
|
||||
states = objects.ScheduledOperationStateList.get_by_filters(
|
||||
ctxt, filters, limit, marker, columns_to_join=columns_to_join)
|
||||
|
|
Loading…
Reference in New Issue