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 19 of 21] CP-1739: vmpp retention value should be betwe

To: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] [PATCH 19 of 21] CP-1739: vmpp retention value should be between 1 and 10
From: Marcus Granado <marcus.granado@xxxxxxxxxx>
Date: Fri, 20 Aug 2010 17:52:38 +0100
Delivery-date: Fri, 20 Aug 2010 10:41:58 -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  |  13 ++++++++++++-
 ocaml/xapi/xapi_vmpp.ml |  14 ++++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)


# HG changeset patch
# User Marcus Granado <marcus.granado@xxxxxxxxxx>
# Date 1282322886 -3600
# Node ID 368c47bcd7445eff795e6c9fa14f5733eed0f034
# Parent  8ef58fae00a0aa69b0d909a18719990bcaab6ff5
CP-1739: vmpp retention value should be between 1 and 10

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

diff -r 8ef58fae00a0 -r 368c47bcd744 ocaml/idl/datamodel.ml
--- a/ocaml/idl/datamodel.ml
+++ b/ocaml/idl/datamodel.ml
@@ -5941,6 +5941,16 @@
 let vmpp_archive_target_config_location = "location"
 let vmpp_archive_target_config_username = "username"
 let vmpp_archive_target_config_password = "password"
+let vmpp_set_backup_retention_value = call ~flags:[`Session]
+  ~name:"set_backup_retention_value"
+  ~in_oss_since:None
+  ~in_product_since:rel_cowley
+  ~allowed_roles:_R_POOL_OP
+  ~params:[
+    Ref _vmpp, "self", "The protection policy";
+    Int, "value", "the value to set"
+  ]
+  ()
 let vmpp_set_is_backup_running = call ~flags:[`Session]
   ~name:"set_is_backup_running"
   ~in_oss_since:None
@@ -6163,6 +6173,7 @@
       vmpp_archive_now;
       vmpp_create_alert;
       vmpp_get_alerts;
+      vmpp_set_backup_retention_value;
       vmpp_set_is_backup_running;
       vmpp_set_is_archive_running;
       vmpp_set_backup_frequency;
@@ -6189,7 +6200,7 @@
       namespace ~name:"name" ~contents:(names None RW) ();
       field ~qualifier:RW ~ty:Bool "is_policy_enabled" "enable or disable this 
policy" ~default_value:(Some (VBool true));
       field ~qualifier:RW ~ty:vmpp_backup_type "backup_type" "type of the 
backup sub-policy";
-      field ~qualifier:RW ~ty:Int "backup_retention_value" "maximum number of 
backups that should be stored at any time" ~default_value:(Some (VInt 1L));
+      field ~qualifier:StaticRO ~ty:Int "backup_retention_value" "maximum 
number of backups that should be stored at any time" ~default_value:(Some (VInt 
1L));
       field ~qualifier:StaticRO ~ty:vmpp_backup_frequency "backup_frequency" 
"frequency of the backup schedule";
       field ~qualifier:StaticRO ~ty:(Map (String,String)) "backup_schedule" 
"schedule of the backup containing 'hour', 'min', 'days'. Date/time-related 
information is in XenServer Local Timezone";
       field ~qualifier:DynamicRO ~ty:Bool "is_backup_running" "true if this 
protection policy's backup is running";
diff -r 8ef58fae00a0 -r 368c47bcd744 ocaml/xapi/xapi_vmpp.ml
--- a/ocaml/xapi/xapi_vmpp.ml
+++ b/ocaml/xapi/xapi_vmpp.ml
@@ -423,6 +423,13 @@
   then
     raise (Api_errors.Server_error 
(Api_errors.vmpp_archive_more_frequent_than_backup,[]))
 
+let assert_backup_retention_value ~backup_retention_value =
+  let value = backup_retention_value in
+  (if (value < 1L) or (value > 10L)
+  then 
+    err "backup_retention_value" "" (Printf.sprintf "%Li" value)
+  )
+
 (* == the setters with customized key cross-integrity checks == *)
 
 (* 1/3: values of non-map fields can only change if their corresponding maps 
contain the expected keys *)
@@ -552,6 +559,11 @@
   assert_licensed ~__context;
   Db.VMPP.set_archive_last_run_time ~__context ~self ~value
 
+let set_backup_retention_value ~__context ~self ~value =
+  assert_licensed ~__context;
+  assert_backup_retention_value ~backup_retention_value:value;
+  Db.VMPP.set_backup_retention_value ~__context ~self ~value
+
 (* constructors/destructors *)
 
 let create ~__context ~name_label ~name_description ~is_policy_enabled
@@ -577,6 +589,8 @@
 
   (* assert frequency constraints *)
   assert_frequency ~archive_frequency ~backup_frequency;
+  (* other constraints *)
+  assert_backup_retention_value ~backup_retention_value;
 
   let ref=Ref.make() in
   let uuid=Uuid.to_string (Uuid.make_uuid()) in

Attachment: xen-api.hg-19.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>