server migrate all

some bugfix
This commit is contained in:
wanyaoqi
2018-10-31 12:25:40 +08:00
parent 3c426fe1a1
commit 24c08ed178
9 changed files with 656 additions and 33 deletions
+9 -7
View File
@@ -286,11 +286,6 @@ func (manager *STaskManager) execTask(taskId string, data jsonutils.JSONObject)
}
log.Debugf("Do task %s(%s) with data %s at stage %s", taskType, taskId, data, baseTask.Stage)
taskValue := reflect.New(taskType)
filled := reflectutils.FillEmbededStructValue(taskValue.Elem(), reflect.Indirect(reflect.ValueOf(baseTask)))
if !filled {
log.Errorf("Cannot locate baseTask embedded struct, give up...")
return
}
if taskValue.Type().Implements(ITaskType) {
execITask(taskValue, baseTask, data, false)
} else if taskValue.Type().Implements(IBatchTaskType) {
@@ -413,11 +408,18 @@ func execITask(taskValue reflect.Value, task *STask, odata jsonutils.JSONObject,
params[2] = reflect.ValueOf(data)
log.Debugf("Call %s %s: %s with %s", task.TaskName, stageName, funcValue, params)
filled := reflectutils.FillEmbededStructValue(taskValue.Elem(), reflect.Indirect(reflect.ValueOf(task)))
if !filled {
log.Errorf("Cannot locate baseTask embedded struct, give up...")
return
}
log.Debugf("Call %s %s: %s with %s", task.TaskName, stageName, funcValue, params)
funcValue.Call(params)
task.SaveRequestContext(&ctxData)
// call save request context
saveRequestContextFuncValue := taskValue.MethodByName("SaveRequestContext")
saveRequestContextFuncValue.Call([]reflect.Value{reflect.ValueOf(&ctxData)})
}
func (task *STask) ScheduleRun(data jsonutils.JSONObject) {