예제 #1
0
 def _create_operation_state(self, operation_id, service_id):
     state_info = {
         'operation_id': operation_id,
         'service_id': service_id,
         'state': constants.OPERATION_STATE_INIT,
     }
     state = objects.ScheduledOperationState(self.context, **state_info)
     state.create()
     return state
 def _create_operation_state(self, operation_id, service_id):
     state_info = {
         'operation_id': operation_id,
         'service_id': service_id,
         'state': 'triggered',
     }
     state = objects.ScheduledOperationState(self, **state_info)
     state.create()
     return state
예제 #3
0
 def _create_operation_state(self, operation_id):
     state_info = {
         "operation_id": operation_id,
         "service_id": self.manager._service_id,
         "state": constants.OPERATION_STATE_REGISTERED
     }
     operation_state = objects.ScheduledOperationState(context,
                                                       **state_info)
     operation_state.create()
     return operation_state
예제 #4
0
    def create_scheduled_operation(self, context, operation_id, trigger_id):
        LOG.debug("Create scheduled operation.")

        # register operation
        self._trigger_manager.register_operation(trigger_id, operation_id)

        # create ScheduledOperationState record
        state_info = {
            "operation_id": operation_id,
            "service_id": self._service_id,
            "state": constants.OPERATION_STATE_REGISTERED
        }
        operation_state = objects.ScheduledOperationState(
            context, **state_info)
        try:
            operation_state.create()
        except Exception:
            self._trigger_manager.unregister_operation(trigger_id,
                                                       operation_id)
            raise