-
Notifications
You must be signed in to change notification settings - Fork 292
CA-287863: xe vm-shutdown complete the task too early #3556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ocaml/xapi/server_helpers.ml
Outdated
forward ~local_fn:f ~__context | ||
in | ||
(* For forwarded task, we should not complete it here, the server which forward the task will complete it *) | ||
if not (Context.forwarded_task __context) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code has become dependent on a condition but indentation has not changed to reflect this. Please check the indentation of the code.
42620dc
to
69783da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant! This also finally gets rid of the stupid "the status of xxx is: success; cannot set it to success" log lines :)
Don't merge yet though, because some BST tests seem to be failing. Please check those out first. |
ocaml/xapi/server_helpers.ml
Outdated
if not (Context.forwarded_task __context) then begin | ||
match marshaller with | ||
| None -> TaskHelper.complete ~__context None | ||
| Some fn -> TaskHelper.complete ~__context (Some (fn result)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robhoes I have some concern about this. After this change, the result in the slave won't be updated to the task result, but instead will update with the execution result in the master, will it bring some other issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should hope that the result of the forwarded call is already always returned (unaltered) by the master to the original caller, especially for synchronous calls. So I think this is fine.
The failing test seems to be an import that times out. We should check how the task completion is handled for such calls, which don't come as RPCs through server.ml, but have their own HTTP handlers. |
Seems the installation of the build is failed, so all BST & BVT failed. I have updated with the latest specs of team/ring3/master and has started rerun the test again. |
Well, the installation was OK, but the 62-create-guest-templates firstboot script failed:
This does a VM metadata import. |
Hmm, I will take a look at that tomorrow. |
Move `exec` into `exec_with_context` to simplify the code. Signed-off-by: Yang Qian <yang.qian@citrix.com>
When master forward a task to slave, slave will mark the task as completed once finish processing it, however when master finishing the forwarding, it will also mark the task as completed. Furthermore, when slave finished the task, that does not mean the task is done, there may be some stuff that master has to handle, so we have to ensure the task only complete once the master finish its work. For the task forwarded from client, which called with `exec_with_forwarded_task`, we also have to complete it once it finished. Signed-off-by: Yang Qian <yang.qian@citrix.com>
BST & BVT passed, please have a look again @robhoes , thanks. |
Hmm... I wonder why |
@robhoes The name of |
Ah, that was another mysterious comment indeed :) |
I think that it is declared a forwarded task, to make sure that the task is not destroyed when the operation completes; the task is created by the client, and should be destroyed by the client. I also notice that the "forwarded task destroyed" log lines that we often see actually mean that the forwarded task was not destroyed... |
We are on the right track here, but before we continue, I am going to make an overview about how tasks and contexts are used in xapi right now, because it is too confusing. |
@robhoes Yes, it takes more than half a day to understand how context/task works. |
Well that is indeed the problem and one of the sources of confusion: the word forwarded is used to different things, or at least the function is "abused" for different things. I think that we should reserve the term "forwarding" for the action of passing a call from the master to a slave (as in "message_forwarding"). I have some ideas now to simplify some of this area, and will do that in follow-up PRs. I'll accept this PR now, because it already fixes a real issue. |
When master forward a task to slave, slave will mark the task as completed once
finish processing it, however when master finishing the forwarding, it will also
mark the task as completed. Furthermore, when slave finished the task, that does
not mean the task is done, there may be some stuff that master has to handle, so
we have to ensure the task only complete once the master finish its work.
Signed-off-by: Yang Qian yang.qian@citrix.com