WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH] dont advertise cancel from revert-from-snapshot since

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] dont advertise cancel from revert-from-snapshot since no good will come of it
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Tue, 16 Mar 2010 12:18:18 +0000
Delivery-date: Tue, 16 Mar 2010 05:09:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1268741876 0
# Node ID 282bc9b84d78a67aea171d234873be6c63ddc307
# Parent  fa283bc2a49fdf01dfd699ba8db4f12d65c979bc
CA-36448: don't advertise the ability to cancel revert-from-snapshot because 
there's nothing to revert too: the old disks need to be destroyed early to make 
enough space for the revert.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>

diff -r fa283bc2a49f -r 282bc9b84d78 ocaml/idl/ocaml_backend/taskHelper.ml
--- a/ocaml/idl/ocaml_backend/taskHelper.ml     Tue Mar 16 11:34:08 2010 +0000
+++ b/ocaml/idl/ocaml_backend/taskHelper.ml     Tue Mar 16 12:17:56 2010 +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 fa283bc2a49f -r 282bc9b84d78 ocaml/idl/ocaml_backend/taskHelper.mli
--- a/ocaml/idl/ocaml_backend/taskHelper.mli    Tue Mar 16 11:34:08 2010 +0000
+++ b/ocaml/idl/ocaml_backend/taskHelper.mli    Tue Mar 16 12:17:56 2010 +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 fa283bc2a49f -r 282bc9b84d78 ocaml/xapi/xapi_vm_clone.ml
--- a/ocaml/xapi/xapi_vm_clone.ml       Tue Mar 16 11:34:08 2010 +0000
+++ b/ocaml/xapi/xapi_vm_clone.ml       Tue Mar 16 12:17:56 2010 +0000
@@ -126,6 +126,8 @@
                (fun vbd -> try (vbd,Db.VDI.get_virtual_size ~__context 
                        ~self:(Db.VBD.get_VDI ~__context ~self:vbd)) with _ -> 
(vbd,0L)) vbds in
        let total = Int64.to_float (List.fold_left (fun tot (_,size) -> 
Int64.add tot size) 0L sizes) in
+
+       Thread.delay 30.;
 
        let fold_function (acc,done_so_far) (vbd,size) =
                try
diff -r fa283bc2a49f -r 282bc9b84d78 ocaml/xapi/xapi_vm_snapshot.ml
--- a/ocaml/xapi/xapi_vm_snapshot.ml    Tue Mar 16 11:34:08 2010 +0000
+++ b/ocaml/xapi/xapi_vm_snapshot.ml    Tue Mar 16 12:17:56 2010 +0000
@@ -382,6 +382,9 @@
 let revert ~__context ~snapshot ~vm =
        debug "Reverting %s to %s" (Ref.string_of vm) (Ref.string_of snapshot);
 
+    (* This is destructive and relatively fast. There's no point advertising 
cancel since it
+          will result in a broken VM. *)
+       TaskHelper.set_not_cancellable ~__context;
        try
                let power_state = Db.VM.get_power_state ~__context 
~self:snapshot in
 
4 files changed, 10 insertions(+), 1 deletion(-)
ocaml/idl/ocaml_backend/taskHelper.ml  |    4 ++++
ocaml/idl/ocaml_backend/taskHelper.mli |    2 +-
ocaml/xapi/xapi_vm_clone.ml            |    2 ++
ocaml/xapi/xapi_vm_snapshot.ml         |    3 +++


Attachment: xen-api.hg.patch
Description: Text Data

_______________________________________________
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] dont advertise cancel from revert-from-snapshot since no good will come of it, David Scott <=