|
|
|
|
|
|
|
|
|
|
xen-api
[Xen-API] [PATCH] CA-35308: Make the revert task not cancellable after r
# HG changeset patch
# User Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx>
CA-35308: Make the revert task not cancellable after reaching a certain point
in the process of reverting.
The goal is to grey out the XenCenter button to not allowing to cancel the
task, as cancelling is not handle correctly after the disks have been cloned.
Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx>
diff -r 0f337a8a1549 ocaml/idl/ocaml_backend/taskHelper.ml
--- a/ocaml/idl/ocaml_backend/taskHelper.ml Fri Dec 11 13:59:38 2009 +0000
+++ b/ocaml/idl/ocaml_backend/taskHelper.ml Fri Dec 11 14:18:59 2009 +0000
@@ -175,6 +175,10 @@
operate_on_db_task ~__context
(fun self -> Db_actions.DB_Action.Task.set_allowed_operations ~__context
~self ~value:[`cancel])
+let set_not_cancellable ~__context =
+ operate_on_db_task ~__context
+ (fun self -> Db_actions.DB_Action.Task.set_allowed_operations ~__context
~self ~value:[])
+
let is_cancelling ~__context =
Context.task_in_database __context &&
let l = Db_actions.DB_Action.Task.get_current_operations ~__context
~self:(Context.get_task_id __context) in
diff -r 0f337a8a1549 ocaml/idl/ocaml_backend/taskHelper.mli
--- a/ocaml/idl/ocaml_backend/taskHelper.mli Fri Dec 11 13:59:38 2009 +0000
+++ b/ocaml/idl/ocaml_backend/taskHelper.mli Fri Dec 11 14:18:59 2009 +0000
@@ -26,10 +26,11 @@
val set_result : __context:Context.t -> Xml.xml list -> unit
val complete : __context:Context.t -> Xml.xml list -> unit
val set_cancellable : __context:Context.t -> unit
+val set_not_cancellable : __context:Context.t -> unit
val is_cancelling : __context:Context.t -> bool
val exn_if_cancelling : __context:Context.t -> unit
val cancel : __context:Context.t -> unit
val failed : __context:Context.t -> string * string list -> unit
val init : unit -> unit
val rbac_assert_permission_fn : (__context:Context.t ->
permission:Db_actions.role_t -> unit) option ref
-val assert_can_destroy : ?ok_if_no_session_in_context:bool ->
__context:Context.t -> [ `task ] Ref.t -> unit
\ No newline at end of file
+val assert_can_destroy : ?ok_if_no_session_in_context:bool ->
__context:Context.t -> [ `task ] Ref.t -> unit
diff -r 0f337a8a1549 ocaml/xapi/xapi_vm_snapshot.ml
--- a/ocaml/xapi/xapi_vm_snapshot.ml Fri Dec 11 13:59:38 2009 +0000
+++ b/ocaml/xapi/xapi_vm_snapshot.ml Fri Dec 11 14:18:59 2009 +0000
@@ -369,6 +369,9 @@
end;
update_vifs_and_vbds ~__context ~snapshot ~vm;
+
+ (* From now on, the task is no more cancellable *)
+ TaskHelper.set_not_cancellable ~__context;
update_guest_metrics ~__context ~snapshot ~vm;
update_parent ~__context ~snapshot ~vm;
TaskHelper.set_progress ~__context 1.;
@@ -385,6 +388,9 @@
raise e
| Api_errors.Server_error("SR_BACKEND_FAILURE_109", _) as e ->
error "Snapshot chain too long";
+ raise e
+ | Api_errors.Server_error(x, _) as e when
x=Api_errors.task_cancelled ->
+ error "Disk clones have been cancelled by the user";
raise e
| _ -> raise (Api_errors.Server_error
(Api_errors.vm_revert_failed, [Ref.string_of snapshot; Ref.string_of vm]))
xapi-revert-cannot-be-cancelled-after-reaching-a-certain-point
Description: Text document
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-API] [PATCH] CA-35308: Make the revert task not cancellable after reaching a certain point in the process of reverting.,
Thomas Gazagnaire <=
|
|
|
|
|