|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH 11 of 21] CP-1835: add optional task-uuid parameter to cli vm-export
ocaml/xapi/cli_operations.ml | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
# HG changeset patch
# User Marcus Granado <marcus.granado@xxxxxxxxxx>
# Date 1282322886 -3600
# Node ID 5ed6061cd4377edb0e9d46a31a69fd9a1dabbf7a
# Parent cf4fa3283659fb55b279c563e3a818ad8ddf7181
CP-1835: add optional task-uuid parameter to cli vm-export
Signed-off-by: Marcus Granado <marcus.granado@xxxxxxxxxxxxx>
diff -r cf4fa3283659 -r 5ed6061cd437 ocaml/xapi/cli_operations.ml
--- a/ocaml/xapi/cli_operations.ml
+++ b/ocaml/xapi/cli_operations.ml
@@ -3075,9 +3075,16 @@
raise (Cli_util.Cli_failure "Need one of: vm-uuid, host-uuid,
network-uuid, sr-uuid or pool-uuid")
-let export_common fd printer rpc session_id params filename num
use_compression preserve_power_state vm =
+let export_common fd printer rpc session_id params filename num ?task_uuid
use_compression preserve_power_state vm =
let vm_record = vm.record () in
- let exporttask = Client.Task.create rpc session_id (Printf.sprintf "Export
of VM: %s" (vm_record.API.vM_uuid)) "" in
+ let exporttask, task_destroy_fn =
+ match task_uuid with
+ | None -> (* manage task internally *)
+ let exporttask = Client.Task.create rpc session_id (Printf.sprintf
"Export of VM: %s" (vm_record.API.vM_uuid)) "" in
+ (exporttask,(fun ()->Client.Task.destroy rpc session_id exporttask))
+ | Some task_uuid -> (* do not destroy the task that has been
received *)
+ ((Client.Task.get_by_uuid rpc session_id
task_uuid),(fun ()->()))
+ in
(* Initially mark the task progress as -1.0. The first thing the export
handler does it to mark it as zero *)
(* This is used as a flag to show that the 'ownership' of the task has been
passed to the handler, and it's *)
@@ -3102,15 +3109,16 @@
preserve_power_state)
"Export";
num := !num + 1)
- (fun () -> Client.Task.destroy rpc session_id exporttask)
+ (fun () -> task_destroy_fn ())
let vm_export fd printer rpc session_id params =
let filename = List.assoc "filename" params in
let use_compression = List.mem_assoc "compress" params && (List.assoc
"compress" params = "true") in
let preserve_power_state = List.mem_assoc "preserve-power-state" params &&
bool_of_string "preserve-power-state" (List.assoc "preserve-power-state"
params) in
+ let task_uuid = if (List.mem_assoc "task-uuid" params) then Some (List.assoc
"task-uuid" params) else None in
let num = ref 1 in
let op vm =
- export_common fd printer rpc session_id params filename num
use_compression preserve_power_state vm
+ export_common fd printer rpc session_id params filename num ?task_uuid
use_compression preserve_power_state vm
in
ignore(do_vm_op printer rpc session_id op params ["filename"; "metadata";
"compress"; "preserve-power-state"])
Attachment:
xen-api.hg-11.patch _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |