Add extra_info when creating checkpoint in scheduled operation

When scheduled operation the creation of checkpoint, pass extra_info
parameter.

Co-authored-by: chenying <ying.chen@huawei.com>
Depends-On: I34c3f2996b11a0597091276eedd120c5222073b4
Change-Id: Id5158e697d427369085e17b3c2b55db1e93239b9
This commit is contained in:
zhangshuai 2016-11-21 14:12:15 +08:00 committed by chenying
parent de9f84272c
commit e6103c6257
5 changed files with 21 additions and 3 deletions

View File

@ -67,6 +67,12 @@ CHECKPOINT_STATUS_DELETING = 'deleting'
CHECKPOINT_STATUS_DELETED = 'deleted'
CHECKPOINT_STATUS_ERROR_DELETING = 'error-deleting'
CHECKPOINT_CREATED_BY = (OPERATION_ENGINE,
MANUAL,
) = ('operation-engine',
'manual',
)
# resource status
RESOURCE_STATUS_ERROR = 'error'
RESOURCE_STATUS_PROTECTING = 'protecting'

View File

@ -144,6 +144,8 @@ class GreenThreadExecutor(base.BaseExecutor):
try:
param['user_id'] = operation.user_id
param['project_id'] = operation.project_id
param['trigger_id'] = operation.trigger_id
param['scheduled_operation_id'] = operation.id
self._operation_manager.run_operation(
operation.operation_type,

View File

@ -91,6 +91,8 @@ class ScheduledOperationExecutor(base.BaseExecutor):
try:
param['user_id'] = operation.user_id
param['project_id'] = operation.project_id
param['trigger_id'] = operation.trigger_id
param['scheduled_operation_id'] = operation.id
self._operation_manager.run_operation(
operation.operation_type,

View File

@ -51,9 +51,17 @@ class ProtectOperation(base.Operation):
def _run(self, operation_definition, param, log_ref):
client = self._create_karbor_client(
param.get("user_id"), param.get("project_id"))
provider_id = operation_definition.get("provider_id")
plan_id = operation_definition.get("plan_id")
trigger_id = param.get("trigger_id", None)
scheduled_operation_id = param.get("scheduled_operation_id", None)
extra_info = {
'created_by': constants.OPERATION_ENGINE,
'trigger_id': trigger_id,
'scheduled_operation_id': scheduled_operation_id
}
try:
client.checkpoints.create(operation_definition.get("provider_id"),
operation_definition.get("plan_id"))
client.checkpoints.create(provider_id, plan_id, extra_info)
except Exception:
state = constants.OPERATION_EXE_STATE_FAILED
else:

View File

@ -34,7 +34,7 @@ class FakeUserTrustManager(object):
class FakeCheckPoint(object):
def create(self, provider_id, plan_id):
def create(self, provider_id, plan_id, extra_info):
return