Merge pull request #53 in YUNIONIO/onecloud from ~WANYAOQI/onecloud:feature/wyq/kvm-server-rebuild-root to release/2.1.0

* commit 'baa7b9e09330352afd2e1088a9f1b837cb12bd09':
  region: server-rebuid-root and fix bug on disk create and disk create failed
This commit is contained in:
邱剑
2018-08-14 21:58:01 +08:00
10 changed files with 236 additions and 19 deletions
+5 -1
View File
@@ -307,7 +307,7 @@ func execITask(taskValue reflect.Value, task *STask, data jsonutils.JSONObject,
var stageName string
if taskFailed {
stageName = fmt.Sprintf("%s_failed", task.Stage)
stageName = fmt.Sprintf("%sFailed", task.Stage)
} else {
stageName = task.Stage
}
@@ -315,6 +315,10 @@ func execITask(taskValue reflect.Value, task *STask, data jsonutils.JSONObject,
funcValue := taskValue.MethodByName(stageName)
if !funcValue.IsValid() || funcValue.IsNil() {
log.Debugf("Stage %s not found, try kebab to camel and find again", stageName)
if taskFailed {
stageName = fmt.Sprintf("%s_failed", task.Stage)
}
stageName = utils.Kebab2Camel(stageName, "_")
funcValue = taskValue.MethodByName(stageName)