WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH 08 of 21] CP-1704: vmpp.protect_now

To: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] [PATCH 08 of 21] CP-1704: vmpp.protect_now
From: Marcus Granado <marcus.granado@xxxxxxxxxx>
Date: Fri, 20 Aug 2010 17:52:27 +0100
Delivery-date: Fri, 20 Aug 2010 10:31:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1282323139@localhost>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1282323139@localhost>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
 ocaml/idl/datamodel.ml   |   3 +++
 ocaml/xapi/xapi_pool.ml  |   9 ++++++++-
 ocaml/xapi/xapi_pool.mli |   2 +-
 ocaml/xapi/xapi_vmpp.ml  |  28 ++++++++++++++++++++++++++--
 4 files changed, 38 insertions(+), 4 deletions(-)


# HG changeset patch
# User Marcus Granado <marcus.granado@xxxxxxxxxx>
# Date 1282322886 -3600
# Node ID e4c575199627ef88a921a25ffe706868cfc8b5ab
# Parent  77539f5be6a532f27a481ae8fa02f181e2bc532a
CP-1704: vmpp.protect_now

Signed-off-by: Marcus Granado <marcus.granado@xxxxxxxxxxxxx>

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

Attachment: xen-api.hg-08.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api