Return an error from a failed task to prevent panic on update
vm.Obj.UUID(vm.Context) during update would cause panic on nil
pointer reference, as a failed task would cause immediate
VM deprovisioning. To prevent this, an error should be surfaced.
@@ -705,7 +705,7 @@ func taskIsFinished(task *mo.Task) (bool, error) {
case types.TaskInfoStateSuccess:
return true, nil
case types.TaskInfoStateError:
- return true, nil
+ return true, errors.New(task.Info.Error.LocalizedMessage)
default:
return false, fmt.Errorf("task: %v, unknown state %v", task.Reference().Value, task.Info.State)
}
