|
|
|
|
|
|
|
|
|
|
xen-api
[Xen-API] [PATCH 11 of 21] CP-1835: add optional task-uuid parameter to
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"])
xen-api.hg-11.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 05 of 21] CP-1803: when reverting from snapshots, do not overwrite vm protection policy, (continued)
- [Xen-API] [PATCH 09 of 21] CP-1704: vmpp.archive-now, Marcus Granado
- [Xen-API] [PATCH 01 of 21] CP-1739: create XAPI datamodel stubs for PR-1031 (VM protection policy), Marcus Granado
- [Xen-API] [PATCH 11 of 21] CP-1835: add optional task-uuid parameter to cli vm-export,
Marcus Granado <=
- [Xen-API] [PATCH 21 of 21] CP-1880: cli autocompletion for vmpp fields, Marcus Granado
- [Xen-API] [PATCH 18 of 21] CP-1739: vmpp.{backup, archive}-last-run-time should be for local-root only, Marcus Granado
- [Xen-API] [PATCH 10 of 21] CP-1800: CLI support for PR-1031 (VM protection policy), Marcus Granado
- [Xen-API] [PATCH 17 of 21] CP-1860: add license checks, Marcus Granado
- [Xen-API] [PATCH 19 of 21] CP-1739: vmpp retention value should be between 1 and 10, Marcus Granado
- [Xen-API] [PATCH 20 of 21] CP-1879: compress data contents in vmpp.create_alert, Marcus Granado
- [Xen-API] [PATCH 15 of 21] CP-1858: add new vmpp message types to api-messages, Marcus Granado
- [Xen-API] [PATCH 13 of 21] CP-1841: add new api call vmpp.get_alerts, Marcus Granado
- [Xen-API] [PATCH 16 of 21] CP-1807: do not allow assigning a VMPP to a Dom0 VM, Marcus Granado
- [Xen-API] [PATCH 14 of 21] CP-1846: add new api call vmpp.create_alert, Marcus Granado
|
|
|
|
|