[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH 18 of 21] CP-1739: vmpp.{backup, archive}-last-run-time should be for local-root only
ocaml/idl/datamodel.ml | 26 ++++++++++++++++++++++++-- ocaml/xapi/cli_operations.ml | 6 ++---- ocaml/xapi/xapi_vmpp.ml | 32 ++++++++++++++------------------ 3 files changed, 40 insertions(+), 24 deletions(-) # HG changeset patch # User Marcus Granado <marcus.granado@xxxxxxxxxx> # Date 1282322886 -3600 # Node ID 8ef58fae00a0aa69b0d909a18719990bcaab6ff5 # Parent 490c915ac23b78f1fe72964069bb7e1b7df31dad CP-1739: vmpp.{backup,archive}-last-run-time should be for local-root only Signed-off-by: Marcus Granado <marcus.granado@xxxxxxxxxxxxx> diff -r 490c915ac23b -r 8ef58fae00a0 ocaml/idl/datamodel.ml --- a/ocaml/idl/datamodel.ml +++ b/ocaml/idl/datamodel.ml @@ -6049,6 +6049,26 @@ Map(String,String), "value", "the value to set" ] () +let vmpp_set_backup_last_run_time = call ~flags:[`Session] + ~name:"set_backup_last_run_time" + ~in_oss_since:None + ~in_product_since:rel_cowley + ~allowed_roles:_R_LOCAL_ROOT_ONLY + ~params:[ + Ref _vmpp, "self", "The protection policy"; + DateTime, "value", "the value to set" + ] + () +let vmpp_set_archive_last_run_time = call ~flags:[`Session] + ~name:"set_archive_last_run_time" + ~in_oss_since:None + ~in_product_since:rel_cowley + ~allowed_roles:_R_LOCAL_ROOT_ONLY + ~params:[ + Ref _vmpp, "self", "The protection policy"; + DateTime, "value", "the value to set" + ] + () let vmpp_add_to_backup_schedule = call ~flags:[`Session] ~name:"add_to_backup_schedule" ~in_oss_since:None @@ -6161,6 +6181,8 @@ vmpp_remove_from_archive_target_config; vmpp_remove_from_archive_schedule; vmpp_remove_from_alarm_config; + vmpp_set_backup_last_run_time; + vmpp_set_archive_last_run_time; ] ~contents:[ uid _vmpp; @@ -6171,13 +6193,13 @@ 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"; - field ~qualifier:RW ~ty:DateTime "backup_last_run_time" "time of the last backup" ~default_value:(Some(VDateTime(Date.of_float 0.))); + field ~qualifier:DynamicRO ~ty:DateTime "backup_last_run_time" "time of the last backup" ~default_value:(Some(VDateTime(Date.of_float 0.))); field ~qualifier:StaticRO ~ty:vmpp_archive_target_type "archive_target_type" "type of the archive target config" ~default_value:(Some (VEnum "none")); field ~qualifier:StaticRO ~ty:(Map (String,String)) "archive_target_config" "configuration for the archive, including its 'location', 'username', 'password'" ~default_value:(Some (VMap [])); field ~qualifier:StaticRO ~ty:vmpp_archive_frequency "archive_frequency" "frequency of the archive schedule" ~default_value:(Some (VEnum "never")); field ~qualifier:StaticRO ~ty:(Map (String,String)) "archive_schedule" "schedule of the archive containing 'hour', 'min', 'days'. Date/time-related information is in XenServer Local Timezone" ~default_value:(Some (VMap [])); field ~qualifier:DynamicRO ~ty:Bool "is_archive_running" "true if this protection policy's archive is running"; - field ~qualifier:RW ~ty:DateTime "archive_last_run_time" "time of the last archive" ~default_value:(Some(VDateTime(Date.of_float 0.))); + field ~qualifier:DynamicRO ~ty:DateTime "archive_last_run_time" "time of the last archive" ~default_value:(Some(VDateTime(Date.of_float 0.))); field ~qualifier:DynamicRO ~ty:(Set (Ref _vm)) "VMs" "all VMs attached to this protection policy"; field ~qualifier:StaticRO ~ty:Bool "is_alarm_enabled" "true if alarm is enabled for this policy" ~default_value:(Some (VBool false)); field ~qualifier:StaticRO ~ty:(Map (String,String)) "alarm_config" "configuration for the alarm" ~default_value:(Some (VMap [])); diff -r 490c915ac23b -r 8ef58fae00a0 ocaml/xapi/cli_operations.ml --- a/ocaml/xapi/cli_operations.ml +++ b/ocaml/xapi/cli_operations.ml @@ -3928,19 +3928,17 @@ let name_description = get "name-description" ~default:"" in let is_policy_enabled = Record_util.bool_of_string(get "is-policy-enabled" ~default:"true") in let backup_retention_value = map "backup-retention-value" ~default:"1" XMLRPC.To.string API.From.int64 in - let backup_last_run_time = Date.of_string (get "backup-last-run-time" ~default:(Date.to_string (Date.of_float 0.))) in let archive_frequency = map "archive-frequency" ~default:"never" XMLRPC.To.string API.From.vmpp_archive_frequency in let archive_target_type = map "archive-target-type" ~default:"none" XMLRPC.To.string API.From.vmpp_archive_target_type in let archive_target_config = read_map_params "archive-target-config" params in let archive_schedule = read_map_params "archive-schedule" params in - let archive_last_run_time = Date.of_string (get "archive-last-run-time" ~default:(Date.to_string (Date.of_float 0.))) in let is_alarm_enabled = Record_util.bool_of_string(get "is-alarm-enabled" ~default:"false") in let alarm_config = read_map_params "alarm-config" params in let ref = Client.VMPP.create ~rpc ~session_id ~name_label ~name_description ~is_policy_enabled ~backup_type ~backup_retention_value ~backup_frequency - ~backup_schedule ~backup_last_run_time ~archive_target_type + ~backup_schedule ~archive_target_type ~archive_target_config ~archive_frequency ~archive_schedule - ~archive_last_run_time ~is_alarm_enabled ~alarm_config + ~is_alarm_enabled ~alarm_config in let uuid = Client.VMPP.get_uuid ~rpc ~session_id ~self:ref in printer (Cli_printer.PList [uuid]) diff -r 490c915ac23b -r 8ef58fae00a0 ocaml/xapi/xapi_vmpp.ml --- a/ocaml/xapi/xapi_vmpp.ml +++ b/ocaml/xapi/xapi_vmpp.ml @@ -65,20 +65,6 @@ Some (String.sub str start len) with _->None -(* -let add_alert_to_audit_log ~__context ~vmpp ~name ~priority ~body = - let session_id=Context.get_session_id __context in - let action="message.create" in - let permission=action in - let uuid = Db.VMPP.get_uuid ~__context ~self:vmpp in - let name_label = Db.VMPP.get_name_label ~__context ~self:vmpp in - let s_name = Rbac_audit.get_sexpr_arg "name" name "" "" in - let s_obj_uuid = Rbac_audit.get_sexpr_arg "obj_uuid" name_label uuid (Ref.string_of vmpp) in - let s_body = Rbac_audit.get_sexpr_arg "body" body "" "" in - let sexpr_of_args = s_name::s_obj_uuid::s_body::[] in - Rbac_audit.allowed_post_fn_ok ~__context ~session_id ~action ~permission ~sexpr_of_args () -*) - let create_alert ~__context ~vmpp ~name ~priority ~body = assert_licensed ~__context; match inside_data_tag body with @@ -558,11 +544,19 @@ assert_non_required_key ~ks:alarm_config_keys ~key ~db:(Db.VMPP.get_alarm_config ~__context ~self); Db.VMPP.remove_from_alarm_config ~__context ~self ~key +let set_backup_last_run_time ~__context ~self ~value = + assert_licensed ~__context; + Db.VMPP.set_backup_last_run_time ~__context ~self ~value + +let set_archive_last_run_time ~__context ~self ~value = + assert_licensed ~__context; + Db.VMPP.set_archive_last_run_time ~__context ~self ~value + (* constructors/destructors *) let create ~__context ~name_label ~name_description ~is_policy_enabled - ~backup_type ~backup_retention_value ~backup_frequency ~backup_schedule ~backup_last_run_time - ~archive_target_type ~archive_target_config ~archive_frequency ~archive_schedule ~archive_last_run_time + ~backup_type ~backup_retention_value ~backup_frequency ~backup_schedule + ~archive_target_type ~archive_target_config ~archive_frequency ~archive_schedule ~is_alarm_enabled ~alarm_config : API.ref_VMPP = @@ -589,10 +583,12 @@ Db.VMPP.create ~__context ~ref ~uuid ~name_label ~name_description ~is_policy_enabled ~backup_type ~backup_retention_value - ~backup_frequency ~backup_schedule ~backup_last_run_time + ~backup_frequency ~backup_schedule + ~backup_last_run_time:(Date.of_float 0.) ~is_backup_running:false ~is_archive_running:false ~archive_target_type ~archive_target_config - ~archive_frequency ~archive_schedule ~archive_last_run_time + ~archive_frequency ~archive_schedule + ~archive_last_run_time:(Date.of_float 0.) ~is_alarm_enabled ~alarm_config ~recent_alerts:[]; ref Attachment:
xen-api.hg-18.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 |