[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH 19 of 21] CP-1739: vmpp retention value should be between 1 and 10
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 _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |