# HG changeset patch # User Marcus Granado # Date 1282322886 -3600 # Node ID e4c575199627ef88a921a25ffe706868cfc8b5ab # Parent 77539f5be6a532f27a481ae8fa02f181e2bc532a CP-1704: vmpp.protect_now Signed-off-by: Marcus Granado diff -r 77539f5be6a5 -r e4c575199627 ocaml/idl/datamodel.ml --- a/ocaml/idl/datamodel.ml +++ b/ocaml/idl/datamodel.ml @@ -5273,6 +5273,7 @@ ] ~doc:"This call tests if a location is valid" ~allowed_roles:_R_POOL_OP + ~result:(String, "An XMLRPC result") () (** A pool class *) @@ -5858,6 +5859,7 @@ ~params:[Ref _vmpp, "vmpp", "The protection policy to execute";] ~doc:"This call executes the protection policy immediately" ~allowed_roles:_R_POOL_OP + ~result:(String, "An XMLRPC result") () let vmpp_archive_now = call ~flags:[`Session] ~name:"archive_now" @@ -5866,6 +5868,7 @@ ~params:[Ref _vm, "snapshot", "The snapshot to archive";] ~doc:"This call archives the snapshot provided as a parameter" ~allowed_roles:_R_VM_POWER_ADMIN + ~result:(String, "An XMLRPC result") () let vmpp_backup_type = Enum ("vmpp_backup_type", [ diff -r 77539f5be6a5 -r e4c575199627 ocaml/xapi/xapi_pool.ml --- a/ocaml/xapi/xapi_pool.ml +++ b/ocaml/xapi/xapi_pool.ml @@ -1457,4 +1457,11 @@ Rbac_audit.append_line ~raw:true "%s" line; () -let test_archive_target ~__context ~self ~config = () +let test_archive_target ~__context ~self ~config = + Xapi_plugins.call_plugin + (Context.get_session_id __context) + Xapi_vmpp.vmpr_plugin + "test_archive_target" + config + + diff -r 77539f5be6a5 -r e4c575199627 ocaml/xapi/xapi_pool.mli --- a/ocaml/xapi/xapi_pool.mli +++ b/ocaml/xapi/xapi_pool.mli @@ -193,4 +193,4 @@ val set_vswitch_controller : __context:Context.t -> address:string -> unit val audit_log_append : __context:Context.t -> line:string -> unit -val test_archive_target : __context:Context.t -> self:API.ref_pool -> config:API.string_to_string_map -> unit +val test_archive_target : __context:Context.t -> self:API.ref_pool -> config:API.string_to_string_map -> string diff -r 77539f5be6a5 -r e4c575199627 ocaml/xapi/xapi_vmpp.ml --- a/ocaml/xapi/xapi_vmpp.ml +++ b/ocaml/xapi/xapi_vmpp.ml @@ -14,6 +14,8 @@ module D = Debug.Debugger(struct let name="xapi" end) open D +let vmpr_plugin = "vmpr" + (* val protect_now : __context:Context.t -> self:ref_VMPP -> unit val archive_now : __context:Context.t -> self:ref_VM -> unit @@ -58,8 +60,30 @@ let destroy ~__context ~self = Db.VMPP.destroy ~__context ~self -let protect_now ~__context ~vmpp = () -let archive_now ~__context ~snapshot = () +let protect_now ~__context ~vmpp = + let vmpp_uuid = Db.VMPP.get_uuid ~__context ~self:vmpp in + let args = [ "vmpp_uuid", vmpp_uuid ] in + Xapi_plugins.call_plugin + (Context.get_session_id __context) + vmpr_plugin + "protect_now" + args + +let archive_now ~__context ~snapshot = "" +(* + let archive_target_config + Xapi_plugins.call_plugin + (Context.get_session_id __context) + vmpr_plugin + "mount_archive_target" + args + + Xapi_plugins.call_plugin + (Context.get_session_id __context) + vmpr_plugin + "unmount_archive_target" + args +*) let set_is_backup_running ~__context ~self ~value = Db.VMPP.set_is_backup_running ~__context ~self ~value