]> xenbits.xensource.com Git - xcp/xen-api.git/commitdiff
CA-43645: add applies_to:vm_ref to the vmpp snapshot task other-config
authorMarcus Granado <marcus.granado@eu.citrix.com>
Tue, 12 Oct 2010 09:55:04 +0000 (10:55 +0100)
committerMarcus Granado <marcus.granado@eu.citrix.com>
Tue, 12 Oct 2010 09:55:04 +0000 (10:55 +0100)
XenCenter uses this key to show the task in the vm_ref's log.

Signed-off-by: Marcus Granado <marcus.granado@eu.citrix.com>
ocaml/xapi/xapi_vm_snapshot.ml
ocaml/xapi/xapi_vmpp.ml

index d12584f69fa54688f2a0912cd94064ed3f8defc3..a110219b5d98824b061488a31f850563598ec36c 100644 (file)
@@ -28,7 +28,7 @@ open D
 let snapshot ~__context ~vm ~new_name =
        debug "Snapshot: begin";
        TaskHelper.set_cancellable ~__context;
-       Xapi_vmpp.show_task_in_xencenter ~__context;
+       Xapi_vmpp.show_task_in_xencenter ~__context ~vm;
        let res = Xapi_vm_clone.clone Xapi_vm_clone.Disk_op_snapshot ~__context ~vm ~new_name in
        debug "Snapshot: end"; 
        res
@@ -129,7 +129,7 @@ let wait_for_snapshot ~__context ~vm ~xs ~domid ~new_name =
 (* dynamically by the xapi_vm_lifecycle.update_allowed_operations call.                  *)
 let snapshot_with_quiesce ~__context ~vm ~new_name =
        debug "snapshot_with_quiesce: begin";
-       Xapi_vmpp.show_task_in_xencenter ~__context;
+       Xapi_vmpp.show_task_in_xencenter ~__context ~vm;
        let domid = Int64.to_int (Db.VM.get_domid ~__context ~self:vm) in
        let result = Vmopshelpers.with_xs (fun xs ->
                (* 1. We first check if the VM supports quiesce-mode *)
@@ -175,7 +175,7 @@ let get_flushable_vbds ~__context vm =
        List.filter aux (Db.VM.get_VBDs ~__context ~self:vm)
 
 let checkpoint ~__context ~vm ~new_name =
-       Xapi_vmpp.show_task_in_xencenter ~__context;
+       Xapi_vmpp.show_task_in_xencenter ~__context ~vm;
        let power_state = Db.VM.get_power_state ~__context ~self:vm in
        with_xc_and_xs (fun xc xs ->
                let vbds = get_flushable_vbds ~__context vm in
index bd7d894dc4c84699188a7ecd824bcbc89a953d89..d05ab73a7f9c9e9aaafc9e923f11616a0c525b9c 100644 (file)
@@ -17,6 +17,7 @@ open D
 let vmpr_plugin = "vmpr"
 let vmpr_username = "__dom0__vmpr"
 let vmpr_snapshot_other_config_show_in_xencenter = "ShowInXenCenter"
+let vmpr_snapshot_other_config_applies_to = "applies_to"
 
 let assert_licensed ~__context =
   if (not (Features.is_enabled ~__context Features.VMPR))
@@ -653,7 +654,7 @@ let is_snapshot_from_vmpp ~__context =
     debug "Error obtaining is_snapshot_from_vmpp: %s" (Printexc.to_string e);
     false
 
-let show_task_in_xencenter ~__context =
+let show_task_in_xencenter ~__context ~vm =
   if is_snapshot_from_vmpp ~__context then
     (
       let task = Context.get_task_id __context in
@@ -663,7 +664,10 @@ let show_task_in_xencenter ~__context =
         (* is seen from all xencenter clients *)
         Db.Task.add_to_other_config ~__context ~self:task
           ~key:vmpr_snapshot_other_config_show_in_xencenter
-          ~value:""
+          ~value:"";
+        Db.Task.add_to_other_config ~__context ~self:task
+          ~key:vmpr_snapshot_other_config_applies_to
+          ~value:(Ref.string_of vm)
       with e->
         debug "Error adding other_config:show_in_xencenter to task %s: %s"
           (Ref.string_of task) (Printexc.to_string e)