]> xenbits.xensource.com Git - xcp/xen-api.git/commitdiff
CP-1704: vmpp.protect_now
authorMarcus Granado <marcus.granado@eu.citrix.com>
Mon, 23 Aug 2010 14:54:36 +0000 (15:54 +0100)
committerMarcus Granado <marcus.granado@eu.citrix.com>
Mon, 23 Aug 2010 14:54:36 +0000 (15:54 +0100)
Signed-off-by: Marcus Granado <marcus.granado@eu.citrix.com>
ocaml/idl/datamodel.ml
ocaml/xapi/xapi_pool.ml
ocaml/xapi/xapi_pool.mli
ocaml/xapi/xapi_vmpp.ml

index 7dd34671db62d49936b5e6d4683dc6770f970fd8..82b934e0fdd44a87439256ffa7639488c623518c 100644 (file)
@@ -5273,6 +5273,7 @@ let pool_test_archive_target = call ~flags:[`Session]
   ]
   ~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 @@ let vmpp_protect_now = call ~flags:[`Session]
   ~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 @@ let vmpp_archive_now = call ~flags:[`Session]
   ~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",
   [
index 872dee99c8c2bdb27ac2ca35a03dd52d31c7ddf2..b5dde3be658a6c23fd088067e4d312d2c8351ffa 100644 (file)
@@ -1457,4 +1457,11 @@ let audit_log_append ~__context ~line =
        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
+
+               
index eafd422b251f0c5ceed01390c89fdcdb756e45aa..c374dac6f49b1137d40465f1ef528612fa2e84e2 100644 (file)
@@ -193,4 +193,4 @@ val disable_redo_log : __context:Context.t -> unit
 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
index d4bfd5e02db1358e81aedf0792b2a20f2df652c1..448e0a0b84f570dee25ff36f0f49a9884cab9923 100644 (file)
@@ -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 create ~__context ~name_label ~name_description ~is_policy_enabled
 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