[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH 01 of 21] CP-1739: create XAPI datamodel stubs for PR-1031 (VM protection policy)
ocaml/idl/datamodel.ml | 136 ++++++++++++++++++++++++++++++++++++++- ocaml/xapi/OMakefile | 1 + ocaml/xapi/api_server.ml | 1 + ocaml/xapi/cli_operations.ml | 2 +- ocaml/xapi/create_misc.ml | 4 +- ocaml/xapi/create_templates.ml | 2 + ocaml/xapi/import_xva.ml | 1 + ocaml/xapi/message_forwarding.ml | 11 ++- ocaml/xapi/xapi_host.ml | 14 ++++ ocaml/xapi/xapi_host.mli | 1 + ocaml/xapi/xapi_pool.ml | 2 + ocaml/xapi/xapi_pool.mli | 2 + ocaml/xapi/xapi_vm.ml | 4 + ocaml/xapi/xapi_vm.mli | 5 +- ocaml/xapi/xapi_vm_clone.ml | 5 +- ocaml/xapi/xapi_vm_helpers.ml | 8 +- ocaml/xapi/xapi_vmpp.ml | 69 +++++++++++++++++++ 17 files changed, 259 insertions(+), 9 deletions(-) # HG changeset patch # User Marcus Granado <marcus.granado@xxxxxxxxxx> # Date 1282322886 -3600 # Node ID 1f0e971a9665a927a9424d8926c3c9d49147eee9 # Parent 86ec25f567788cb5a3272e3ec09581a892c9275c CP-1739: create XAPI datamodel stubs for PR-1031 (VM protection policy) Signed-off-by: Marcus Granado <marcus.granado@xxxxxxxxxxxxx> diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/idl/datamodel.ml --- a/ocaml/idl/datamodel.ml +++ b/ocaml/idl/datamodel.ml @@ -60,6 +60,7 @@ let _vm = "VM" let _vm_metrics = "VM_metrics" let _vm_guest_metrics = "VM_guest_metrics" +let _vmpp = "VMPP" let _network = "network" let _vif = "VIF" let _vif_metrics = "VIF_metrics" @@ -149,6 +150,12 @@ | x::xs -> if x=in_product_since then "closed"::x::xs else go_through_release_order xs in go_through_release_order release_order +let cowley_release = + { internal=get_product_releases rel_cowley + ; opensource=get_oss_releases None + ; internal_deprecated_since=None + } + let midnight_ride_release = { internal=get_product_releases "midnight-ride" ; opensource=get_oss_releases None @@ -3410,6 +3417,16 @@ ~allowed_roles:_R_READ_ONLY () +let host_get_server_localtime = call ~flags:[`Session] + ~name:"get_server_localtime" + ~in_oss_since:None + ~in_product_since:rel_cowley + ~params:[Ref _host, "host", "The host whose clock should be queried"] + ~doc:"This call queries the host's clock for the current time in the host's local timezone" + ~result:(DateTime, "The current local time") + ~allowed_roles:_R_READ_ONLY + () + let host_emergency_ha_disable = call ~flags:[`Session] ~name:"emergency_ha_disable" ~in_oss_since:None @@ -3666,6 +3683,7 @@ host_create_new_blob; host_call_plugin; host_get_servertime; + host_get_server_localtime; host_enable_binary_storage; host_disable_binary_storage; host_enable_external_auth; @@ -5246,6 +5264,17 @@ ~allowed_roles:_R_POOL_OP () +let pool_test_archive_target = call ~flags:[`Session] + ~name:"test_archive_target" + ~in_oss_since:None + ~in_product_since:rel_cowley + ~params:[Ref _pool, "self", "Reference to the pool"; + Map(String,String), "config", "Location config settings to test"; + ] + ~doc:"This call tests if a location is valid" + ~allowed_roles:_R_POOL_OP + () + (** A pool class *) let pool = create_obj @@ -5307,6 +5336,7 @@ ; pool_disable_redo_log ; pool_audit_log_append ; pool_set_vswitch_controller + ; pool_test_archive_target ] ~contents: [uid ~in_oss_since:None _pool @@ -5759,6 +5789,8 @@ field ~writer_roles:_R_VM_POWER_ADMIN ~qualifier:DynamicRO ~in_product_since:rel_midnight_ride ~ty:(Set (Ref _vm)) "children" "List pointing to all the children of this VM"; field ~qualifier:DynamicRO ~in_product_since:rel_midnight_ride ~default_value:(Some (VMap [])) ~ty:(Map (String,String)) "bios_strings" "BIOS strings"; + field ~writer_roles:_R_VM_POWER_ADMIN ~qualifier:RW ~in_product_since:rel_cowley ~default_value:(Some (VRef (Ref.string_of Ref.null))) ~ty:(Ref _vmpp) "protection_policy" "Ref pointing to a protection policy for this VM"; + field ~writer_roles:_R_POOL_OP ~qualifier:StaticRO ~in_product_since:rel_cowley ~default_value:(Some (VBool false)) ~ty:Bool "is_snapshot_from_vmpp" "true if this snapshot was created by the protection policy"; ]) () @@ -5818,6 +5850,105 @@ ] () +(* VM protection policy *) +let vmpp_protect_now = call ~flags:[`Session] + ~name:"protect_now" + ~in_oss_since:None + ~in_product_since:rel_cowley + ~params:[Ref _vmpp, "vmpp", "The protection policy to execute";] + ~doc:"This call executes the protection policy immediately" + ~allowed_roles:_R_POOL_OP + () +let vmpp_archive_now = call ~flags:[`Session] + ~name:"archive_now" + ~in_oss_since:None + ~in_product_since:rel_cowley + ~params:[Ref _vm, "snapshot", "The snapshot to archive";] + ~doc:"This call archives the snapshot provided as a parameter" + ~allowed_roles:_R_VM_POWER_ADMIN + () +let vmpp_backup_type = Enum ("vmpp_backup_type", + [ + "snapshot", "The backup is a snapshot"; + "checkpoint", "The backup is a checkpoint"; + ]) +let vmpp_backup_frequency = Enum ("vmpp_backup_frequency", + [ + "hourly", "Hourly backups"; + "daily", "Daily backups"; + "weekly", "Weekly backups"; + ]) +let vmpp_archive_frequency = Enum ("vmpp_archive_frequency", + [ + "never", "Never archive"; + "always_after_backup", "Archive after backup"; + "daily", "Daily archives"; + "weekly", "Weekly backups"; + ]) +let vmpp_archive_target_type = Enum ("vmpp_archive_target_type", + [ + "none", "No target config"; + "cifs", "CIFS target config"; + "nfs", "NFS target config"; + ]) +let vmpp_set_is_backup_running = call ~flags:[`Session] + ~name:"set_is_backup_running" + ~in_oss_since:None + ~in_product_since:rel_cowley + ~params:[ + Ref _vmpp, "self", "The protection policy"; + Bool, "value", "true to mark this protection policy's backup is running" + ] + ~doc:"This call marks that a protection policy's backup is running" + ~allowed_roles:_R_LOCAL_ROOT_ONLY + ~hide_from_docs:true + () +let vmpp_set_is_archive_running = call ~flags:[`Session] + ~name:"set_is_archive_running" + ~in_oss_since:None + ~in_product_since:rel_cowley + ~params:[ + Ref _vmpp, "self", "The protection policy"; + Bool, "value", "true to mark this protection policy's archive is running" + ] + ~doc:"This call marks that a protection policy's archive is running" + ~allowed_roles:_R_LOCAL_ROOT_ONLY + ~hide_from_docs:true + () +let vmpp = + create_obj ~in_db:true ~in_product_since:rel_cowley ~in_oss_since:None ~internal_deprecated_since:None ~persist:PersistEverything ~gen_constructor_destructor:true ~name:_vmpp ~descr:"VM Protection Policy" + ~gen_events:true + ~doccomments:[] + ~messages_default_allowed_roles:_R_POOL_OP + ~messages:[ + vmpp_protect_now; + vmpp_archive_now; + vmpp_set_is_backup_running; + vmpp_set_is_archive_running; + ] + ~contents:[ + uid _vmpp; + 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:RW ~ty:vmpp_backup_frequency "backup_frequency" "frequency of the backup schedule"; + field ~qualifier:RW ~ty:(Map (String,String)) "backup_schedule" "schedule of the backup containing 'frequency', '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:RW ~ty:vmpp_archive_target_type "archive_target_type" "type of the archive target config" ~default_value:(Some (VEnum "none")); + field ~qualifier:RW ~ty:(Map (String,String)) "archive_target_config" "configuration for the archive, including its 'type' in {'cifs','nfs'}" ~default_value:(Some (VMap [])); + field ~qualifier:RW ~ty:vmpp_archive_frequency "archive_frequency" "frequency of the archive schedule" ~default_value:(Some (VEnum "never")); + field ~qualifier:RW ~ty:(Map (String,String)) "archive_schedule" "schedule of the archive containing 'frequency', '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:(Set (Ref _vm)) "VMs" "all VMs attached to this protection policy"; + field ~qualifier:RW ~ty:Bool "is_alarm_enabled" "true if alarm is enabled for this policy" ~default_value:(Some (VBool false)); + field ~qualifier:RW ~ty:(Map (String,String)) "alarm_config" "configuration for the alarm" ~default_value:(Some (VMap [])); + field ~qualifier:DynamicRO ~ty:(Set (String)) "recent_alerts" "recent alerts" ~default_value:(Some (VSet [])); + ] + () + (** events handling: *) let event_operation = Enum ("event_operation", @@ -6089,6 +6220,7 @@ vm; vm_metrics; vm_guest_metrics; + vmpp; host; host_crashdump; host_patch; @@ -6175,6 +6307,8 @@ (_subject, "roles"), (_subject, "roles"); (*(_subject, "roles"), (_role, "subjects");*) (_role, "subroles"), (_role, "subroles"); + + (_vm, "protection_policy"), (_vmpp, "VMs"); ] (** the full api specified here *) @@ -6218,7 +6352,7 @@ or SR *) let expose_get_all_messages_for = [ _task; (* _alert; *) _host; _host_metrics; _hostcpu; _sr; _vm; _vm_metrics; _vm_guest_metrics; _network; _vif; _vif_metrics; _pif; _pif_metrics; _pbd; _vdi; _vbd; _vbd_metrics; _console; - _crashdump; _host_crashdump; _host_patch; _pool; _sm; _pool_patch; _bond; _vlan; _blob; _subject; _role; _secret; _tunnel ] + _crashdump; _host_crashdump; _host_patch; _pool; _sm; _pool_patch; _bond; _vlan; _blob; _subject; _role; _secret; _tunnel; _vmpp; ] let no_task_id_for = [ _task; (* _alert; *) _event ] diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/OMakefile --- a/ocaml/xapi/OMakefile +++ b/ocaml/xapi/OMakefile @@ -110,6 +110,7 @@ xapi_subject \ xapi_role \ audit_log \ + xapi_vmpp \ xapi_vm_lifecycle \ xapi_vm_clone \ xapi_vm_snapshot \ diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/api_server.ml --- a/ocaml/xapi/api_server.ml +++ b/ocaml/xapi/api_server.ml @@ -34,6 +34,7 @@ end module VM_metrics = struct end module VM_guest_metrics = struct end + module VMPP = Xapi_vmpp module Host = Xapi_host module Host_crashdump = Xapi_host_crashdump diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/cli_operations.ml --- a/ocaml/xapi/cli_operations.ml +++ b/ocaml/xapi/cli_operations.ml @@ -1434,7 +1434,7 @@ ~actions_after_shutdown:`destroy ~actions_after_reboot:`restart ~actions_after_crash:`destroy ~pV_bootloader:"" ~pV_kernel:"" ~pV_ramdisk:"" ~pV_args:"" ~pV_bootloader_args:"" ~pV_legacy_args:"" ~hVM_boot_policy:"" ~hVM_boot_params:[] ~hVM_shadow_multiplier:1. ~platform:[] ~pCI_bus:"" ~other_config:[] ~xenstore_data:[] ~recommendations:"" ~ha_always_run:false ~ha_restart_priority:"" - ~tags:[] in + ~tags:[] ~protection_policy:Ref.null ~is_snapshot_from_vmpp:false in let uuid=Client.VM.get_uuid rpc session_id vm in printer (Cli_printer.PList [uuid]) diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/create_misc.ml --- a/ocaml/xapi/create_misc.ml +++ b/ocaml/xapi/create_misc.ml @@ -174,7 +174,9 @@ ~ha_restart_priority:"" ~ha_always_run:false ~recommendations:"" ~last_boot_CPU_flags:[] ~last_booted_record:"" ~guest_metrics:Ref.null ~metrics - ~bios_strings:[]; + ~bios_strings:[] ~protection_policy:Ref.null + ~is_snapshot_from_vmpp:false + ; Xapi_vm_helpers.update_memory_overhead ~__context ~vm:domain_zero_ref and create_domain_zero_console_record ~__context ~domain_zero_ref = diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/create_templates.ml --- a/ocaml/xapi/create_templates.ml +++ b/ocaml/xapi/create_templates.ml @@ -208,6 +208,8 @@ vM_tags = []; vM_bios_strings = []; + vM_protection_policy = Ref.null; + vM_is_snapshot_from_vmpp = false; } let other_install_media_template memory = diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/import_xva.ml --- a/ocaml/xapi/import_xva.ml +++ b/ocaml/xapi/import_xva.ml @@ -82,6 +82,7 @@ ~pV_args:"" ~pCI_bus:"" ~other_config:[] ~xenstore_data:[] ~recommendations:"" ~ha_always_run:false ~ha_restart_priority:"" ~tags:[] + ~protection_policy:Ref.null ~is_snapshot_from_vmpp:false in TaskHelper.operate_on_db_task ~__context diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/message_forwarding.ml --- a/ocaml/xapi/message_forwarding.ml +++ b/ocaml/xapi/message_forwarding.ml @@ -505,6 +505,7 @@ module Role = Local.Role module Task = Local.Task module Event = Local.Event + module VMPP = Local.VMPP (* module Alert = Local.Alert *) module Pool = struct @@ -850,9 +851,9 @@ (* -------------------------------------------------------------------------- *) (* don't forward create. this just makes a db record *) - let create ~__context ~name_label ~name_description ~user_version ~is_a_template ~affinity ~memory_target ~memory_static_max ~memory_dynamic_max ~memory_dynamic_min ~memory_static_min ~vCPUs_params ~vCPUs_max ~vCPUs_at_startup ~actions_after_shutdown ~actions_after_reboot ~actions_after_crash ~pV_bootloader ~pV_kernel ~pV_ramdisk ~pV_args ~pV_bootloader_args ~pV_legacy_args ~hVM_boot_policy ~hVM_boot_params ~hVM_shadow_multiplier ~platform ~pCI_bus ~other_config ~recommendations ~xenstore_data ~ha_always_run ~ha_restart_priority ~tags ~blocked_operations = + let create ~__context ~name_label ~name_description ~user_version ~is_a_template ~affinity ~memory_target ~memory_static_max ~memory_dynamic_max ~memory_dynamic_min ~memory_static_min ~vCPUs_params ~vCPUs_max ~vCPUs_at_startup ~actions_after_shutdown ~actions_after_reboot ~actions_after_crash ~pV_bootloader ~pV_kernel ~pV_ramdisk ~pV_args ~pV_bootloader_args ~pV_legacy_args ~hVM_boot_policy ~hVM_boot_params ~hVM_shadow_multiplier ~platform ~pCI_bus ~other_config ~recommendations ~xenstore_data ~ha_always_run ~ha_restart_priority ~tags ~blocked_operations ~protection_policy = info "VM.create: name_label = '%s' name_description = '%s'" name_label name_description; - Local.VM.create ~__context ~name_label ~name_description ~user_version ~is_a_template ~affinity ~memory_target ~memory_static_max ~memory_dynamic_max ~memory_dynamic_min ~memory_static_min ~vCPUs_params ~vCPUs_max ~vCPUs_at_startup ~actions_after_shutdown ~actions_after_reboot ~actions_after_crash ~pV_bootloader ~pV_kernel ~pV_ramdisk ~pV_args ~pV_bootloader_args ~pV_legacy_args ~hVM_boot_policy ~hVM_boot_params ~hVM_shadow_multiplier ~platform ~pCI_bus ~other_config ~recommendations ~xenstore_data ~ha_always_run ~ha_restart_priority ~tags ~blocked_operations + Local.VM.create ~__context ~name_label ~name_description ~user_version ~is_a_template ~affinity ~memory_target ~memory_static_max ~memory_dynamic_max ~memory_dynamic_min ~memory_static_min ~vCPUs_params ~vCPUs_max ~vCPUs_at_startup ~actions_after_shutdown ~actions_after_reboot ~actions_after_crash ~pV_bootloader ~pV_kernel ~pV_ramdisk ~pV_args ~pV_bootloader_args ~pV_legacy_args ~hVM_boot_policy ~hVM_boot_params ~hVM_shadow_multiplier ~platform ~pCI_bus ~other_config ~recommendations ~xenstore_data ~ha_always_run ~ha_restart_priority ~tags ~blocked_operations ~protection_policy (* don't forward destroy. this just deletes db record *) let destroy ~__context ~self = @@ -2068,6 +2069,12 @@ do_op_on ~local_fn ~__context ~host (fun session_id rpc -> Client.Host.get_servertime rpc session_id host) + let get_server_localtime ~__context ~host = + (* info "Host.get_servertime"; *) (* suppressed because the GUI calls this frequently and it isn't interesting for debugging *) + let local_fn = Local.Host.get_server_localtime ~host in + do_op_on ~local_fn ~__context ~host + (fun session_id rpc -> Client.Host.get_server_localtime rpc session_id host) + let enable_binary_storage ~__context ~host = info "Host.enable_binary_storage: host = '%s'" (host_uuid ~__context host); let local_fn = Local.Host.enable_binary_storage ~host in diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/xapi_host.ml --- a/ocaml/xapi/xapi_host.ml +++ b/ocaml/xapi/xapi_host.ml @@ -928,6 +928,20 @@ let get_servertime ~__context ~host = Date.of_float (Unix.gettimeofday ()) +let get_server_localtime ~__context ~host = + let gmt_time= Unix.gettimeofday () in + let local_time = Unix.localtime gmt_time in + Date.of_string + ( + Printf.sprintf "%04d%02d%02dT%02d:%02d:%02d" + (local_time.Unix.tm_year+1900) + (local_time.Unix.tm_mon+1) + local_time.Unix.tm_mday + local_time.Unix.tm_hour + local_time.Unix.tm_min + local_time.Unix.tm_sec + ) + let enable_binary_storage ~__context ~host = Unixext.mkdir_safe Xapi_globs.xapi_blob_location 0o700; Db.Host.remove_from_other_config ~__context ~self:host ~key:Xapi_globs.host_no_local_storage diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/xapi_host.mli --- a/ocaml/xapi/xapi_host.mli +++ b/ocaml/xapi/xapi_host.mli @@ -168,6 +168,7 @@ val sync_data : __context:Context.t -> host:API.ref_host -> unit val backup_rrds : __context:'a -> host:'b -> delay:float -> unit val get_servertime : __context:'a -> host:'b -> Date.iso8601 +val get_server_localtime : __context:'a -> host:'b -> Date.iso8601 val enable_binary_storage : __context:Context.t -> host:[ `host ] Ref.t -> unit val disable_binary_storage : diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/xapi_pool.ml --- a/ocaml/xapi/xapi_pool.ml +++ b/ocaml/xapi/xapi_pool.ml @@ -1456,3 +1456,5 @@ (* copy audit record from slave exactly as it is, without any new prefixes *) Rbac_audit.append_line ~raw:true "%s" line; () + +let test_archive_target ~__context ~self ~config = () diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/xapi_pool.mli --- a/ocaml/xapi/xapi_pool.mli +++ b/ocaml/xapi/xapi_pool.mli @@ -192,3 +192,5 @@ (** VSwitch Controller *) 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 diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/xapi_vm.ml --- a/ocaml/xapi/xapi_vm.ml +++ b/ocaml/xapi/xapi_vm.ml @@ -822,6 +822,8 @@ ~ha_restart_priority ~tags ~blocked_operations + ~protection_policy + ~is_snapshot_from_vmpp : API.ref_VM = let gen_mac_seed () = Uuid.to_string (Uuid.make_uuid ()) in (* Add random mac_seed if there isn't one specified already *) @@ -864,6 +866,8 @@ ~ha_restart_priority ~tags ~blocked_operations + ~protection_policy + ~is_snapshot_from_vmpp let destroy ~__context ~self = let parent = Db.VM.get_parent ~__context ~self in diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/xapi_vm.mli --- a/ocaml/xapi/xapi_vm.mli +++ b/ocaml/xapi/xapi_vm.mli @@ -181,7 +181,10 @@ xenstore_data:(string * string) list -> ha_always_run:bool -> ha_restart_priority:string -> - tags:string list -> blocked_operations:'a -> API.ref_VM + tags:string list -> blocked_operations:'a -> + protection_policy:[ `VMPP ] Ref.t -> + is_snapshot_from_vmpp:bool +-> API.ref_VM val destroy : __context:Context.t -> self:[ `VM ] Ref.t -> unit val clone : __context:Context.t -> vm:API.ref_VM -> new_name:string -> [ `VM ] Ref.t diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/xapi_vm_clone.ml --- a/ocaml/xapi/xapi_vm_clone.ml +++ b/ocaml/xapi/xapi_vm_clone.ml @@ -307,7 +307,10 @@ ~ha_restart_priority:all.Db_actions.vM_ha_restart_priority ~ha_always_run:false ~tags:all.Db_actions.vM_tags - ~bios_strings:all.Db_actions.vM_bios_strings; + ~bios_strings:all.Db_actions.vM_bios_strings + ~protection_policy:Ref.null + ~is_snapshot_from_vmpp:false(*from_protection_policy*) + ; ref, uuid diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/xapi_vm_helpers.ml --- a/ocaml/xapi/xapi_vm_helpers.ml +++ b/ocaml/xapi/xapi_vm_helpers.ml @@ -115,7 +115,8 @@ ~platform ~pCI_bus ~other_config ~xenstore_data ~recommendations ~ha_always_run ~ha_restart_priority ~tags - ~blocked_operations + ~blocked_operations ~protection_policy + ~is_snapshot_from_vmpp : API.ref_VM = (* NB parameter validation is delayed until VM.start *) @@ -175,7 +176,10 @@ ~blobs:[] ~ha_restart_priority ~ha_always_run ~tags - ~bios_strings:[]; + ~bios_strings:[] + ~protection_policy:Ref.null + ~is_snapshot_from_vmpp:false + ; Db.VM.set_power_state ~__context ~self:vm_ref ~value:`Halted; Xapi_vm_lifecycle.update_allowed_operations ~__context ~self:vm_ref; update_memory_overhead ~__context ~vm:vm_ref; diff -r 86ec25f56778 -r 1f0e971a9665 ocaml/xapi/xapi_vmpp.ml --- /dev/null +++ b/ocaml/xapi/xapi_vmpp.ml @@ -0,0 +1,69 @@ +(* + * Copyright (C) 2006-2009 Citrix Systems Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; version 2.1 only. with the special + * exception on linking described in file LICENSE. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + *) +module D = Debug.Debugger(struct let name="xapi" end) +open D + +(* + val protect_now : __context:Context.t -> self:ref_VMPP -> unit + val archive_now : __context:Context.t -> self:ref_VM -> unit + val test_archive_settings : + __context:Context.t -> settings:API.string_to_string_map -> unit + val create : + __context:Context.t -> + name_label:string -> + name_description:string -> + is_policy_enabled:bool -> + backup_frequency:API.vmpp_backup_frequency -> + backup_retention_value:int64 -> + backup_schedule:API.string_to_string_map -> + backup_last_run_time:API.datetime -> + archive_target_config_type:API.vmpp_archive_target_config_type -> + archive_target_config:API.string_to_string_map -> + archive_frequency:API.vmpp_archive_frequency -> + archive_schedule:API.string_to_string_map -> + archive_last_run_time:API.datetime -> + is_alarm_enabled:bool -> + alarm_config:API.string_to_string_map -> API.ref_VMPP + val destroy : __context:Context.t -> self:API.ref_VMPP -> unit +*) + +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 + ~is_alarm_enabled ~alarm_config +: API.ref_VMPP = + let ref=Ref.make() in + let uuid=Uuid.to_string (Uuid.make_uuid()) in + 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 + ~is_backup_running:false ~is_archive_running:false + ~archive_target_config ~archive_target_type + ~archive_frequency ~archive_schedule ~archive_last_run_time + ~is_alarm_enabled ~alarm_config ~recent_alerts:[]; + ref + +let destroy ~__context ~self = + Db.VMPP.destroy ~__context ~self + +let protect_now ~__context ~vmpp = () +let archive_now ~__context ~snapshot = () + +let set_is_backup_running ~__context ~self ~value = + Db.VMPP.set_is_backup_running ~__context ~self ~value +let set_is_archive_running ~__context ~self ~value = + Db.VMPP.set_is_archive_running ~__context ~self ~value + + Attachment:
xen-api.hg-01.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 |