[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH] CP-1622: Add set and reset functions to alter CPU feature masks to the datamodel
# HG changeset patch # User Rob Hoes <rob.hoes@xxxxxxxxxx> CP-1622: Add set and reset functions to alter CPU feature masks to the datamodel Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx> diff -r ea5d2d9e7ab0 ocaml/client_records/records.ml --- a/ocaml/client_records/records.ml Thu Feb 04 10:37:18 2010 +0000 +++ b/ocaml/client_records/records.ml Thu Feb 04 14:12:33 2010 +0000 @@ -896,6 +896,7 @@ ~add_to_map:(fun k v -> Client.Host.add_to_other_config rpc session_id host k v) ~remove_from_map:(fun k -> Client.Host.remove_from_other_config rpc session_id host k) ~get_map:(fun () -> (x ()).API.host_other_config) (); + make_field ~name:"cpu_info" ~get:(fun () -> Record_util.s2sm_to_string "; " (x ()).API.host_cpu_info) ~get_map:(fun () -> (x ()).API.host_cpu_info) (); make_field ~name:"hostname" ~get:(fun () -> (x ()).API.host_hostname) (); make_field ~name:"address" ~get:(fun () -> (x ()).API.host_address) (); make_field ~name:"supported-bootloaders" ~get:(fun () -> String.concat "; " (x ()).API.host_supported_bootloaders) diff -r ea5d2d9e7ab0 ocaml/idl/api_errors.ml --- a/ocaml/idl/api_errors.ml Thu Feb 04 10:37:18 2010 +0000 +++ b/ocaml/idl/api_errors.ml Thu Feb 04 14:12:33 2010 +0000 @@ -287,6 +287,8 @@ let license_file_deprecated = "LICENSE_FILE_DEPRECATED" let activation_while_not_free = "ACTIVATION_WHILE_NOT_FREE" +let feature_restricted = "FEATURE_RESTRICTED" + let xmlrpc_unmarshal_failure = "XMLRPC_UNMARSHAL_FAILURE" let duplicate_vm = "DUPLICATE_VM" @@ -368,3 +370,6 @@ let vm_bios_strings_already_set = "VM_BIOS_STRINGS_ALREADY_SET" +let invalid_feature_string = "INVALID_FEATURE_STRING" +let cpu_feature_masking_not_supported = "CPU_FEATURE_MASKING_NOT_SUPPORTED" + diff -r ea5d2d9e7ab0 ocaml/idl/datamodel.ml --- a/ocaml/idl/datamodel.ml Thu Feb 04 10:37:18 2010 +0000 +++ b/ocaml/idl/datamodel.ml Thu Feb 04 14:12:33 2010 +0000 @@ -291,6 +291,9 @@ ~doc:"This license file is no longer accepted. Please upgrade to the new licensing system." (); error Api_errors.activation_while_not_free [] ~doc:"An activation key can only be applied when the edition is set to 'free'." (); + + error Api_errors.feature_restricted [] + ~doc:"The use of this feature is restricted." (); error Api_errors.cannot_contact_host ["host"] ~doc:"Cannot forward messages because the host cannot be contacted. The host may be switched off or there may be network connectivity problems." (); @@ -909,6 +912,14 @@ error Api_errors.vm_bios_strings_already_set [] ~doc:"The BIOS strings for this VM have already been set and cannot be changed anymore." (); + (* CPU feature masking (a.k.a. Intel FlexMigration or AMD Extended Migration technology) *) + + error Api_errors.invalid_feature_string ["details"] + ~doc:"The given feature string is not valid." (); + + error Api_errors.cpu_feature_masking_not_supported ["details"] + ~doc:"The CPU does not support masking of features." (); + () @@ -3430,9 +3441,27 @@ ~allowed_roles:_R_POOL_OP () - - - +let host_set_cpu_features = call ~flags:[`Session] + ~name:"set_cpu_features" + ~in_product_since:rel_midnight_ride + ~doc:"Set the CPU features to be used after a reboot, if the given features string is valid." + ~params:[ + Ref _host, "host", "The host"; + String, "features", "The features string (32 hexadecimal digits)" + ] + ~allowed_roles:_R_POOL_OP + () + +let host_reset_cpu_features = call ~flags:[`Session] + ~name:"reset_cpu_features" + ~in_product_since:rel_midnight_ride + ~doc:"Remove the feature mask, such that after a reboot all features of the CPU are enabled." + ~params:[ + Ref _host, "host", "The host" + ] + ~allowed_roles:_R_POOL_OP + () + (** Hosts *) let host = create_obj ~in_db:true ~in_product_since:rel_rio ~in_oss_since:oss_since_303 ~internal_deprecated_since:None ~persist:PersistEverything ~gen_constructor_destructor:false ~name:_host ~descr:"A physical host" ~gen_events:true @@ -3502,6 +3531,8 @@ host_apply_edition; host_refresh_pack_info; host_set_power_on_mode; + host_set_cpu_features; + host_reset_cpu_features; ] ~contents: ([ uid _host; @@ -3525,6 +3556,7 @@ field ~in_oss_since:None ~qualifier:DynamicRO ~ty:(Set (Ref _host_patch)) "patches" "Set of host patches"; field ~qualifier:DynamicRO ~ty:(Set (Ref _pbd)) "PBDs" "physical blockdevices"; field ~qualifier:DynamicRO ~ty:(Set (Ref _hostcpu)) "host_CPUs" "The physical CPUs on this host"; + field ~qualifier:DynamicRO ~in_product_since:rel_midnight_ride ~default_value:(Some (VMap [])) ~ty:(Map(String, String)) "cpu_info" "Details about the physical CPUs on this host"; field ~in_oss_since:None ~qualifier:RW ~ty:String "hostname" "The hostname of this host"; field ~in_oss_since:None ~qualifier:RW ~ty:String "address" "The address by which this host can be contacted from any other host in the pool"; field ~qualifier:DynamicRO ~ty:(Ref _host_metrics) "metrics" "metrics associated with this host"; diff -r ea5d2d9e7ab0 ocaml/xapi/message_forwarding.ml --- a/ocaml/xapi/message_forwarding.ml Thu Feb 04 10:37:18 2010 +0000 +++ b/ocaml/xapi/message_forwarding.ml Thu Feb 04 14:12:33 2010 +0000 @@ -2126,6 +2126,16 @@ info "Host.refresh_pack_info: host = '%s'" (host_uuid ~__context host); let local_fn = Local.Host.refresh_pack_info ~host in do_op_on ~local_fn ~__context ~host (fun session_id rpc -> Client.Host.refresh_pack_info rpc session_id host) + + let set_cpu_features ~__context ~host ~features = + info "Host.set_cpu_features: host = '%s'; features = '%s'" (host_uuid ~__context host) features; + let local_fn = Local.Host.set_cpu_features ~host ~features in + do_op_on ~local_fn ~__context ~host (fun session_id rpc -> Client.Host.set_cpu_features rpc session_id host features) + + let reset_cpu_features ~__context ~host = + info "Host.reset_cpu_features: host = '%s'" (host_uuid ~__context host); + let local_fn = Local.Host.reset_cpu_features ~host in + do_op_on ~local_fn ~__context ~host (fun session_id rpc -> Client.Host.reset_cpu_features rpc session_id host) end module Host_crashdump = struct diff -r ea5d2d9e7ab0 ocaml/xapi/xapi_host.ml --- a/ocaml/xapi/xapi_host.ml Thu Feb 04 10:37:18 2010 +0000 +++ b/ocaml/xapi/xapi_host.ml Thu Feb 04 14:12:33 2010 +0000 @@ -630,6 +630,7 @@ ~name_description ~name_label ~uuid ~other_config:[] ~capabilities:[] ~cpu_configuration:[] (* !!! FIXME hard coding *) + ~cpu_info:[] ~memory_overhead:0L ~sched_policy:"credit" (* !!! FIXME hard coding *) ~supported_bootloaders:(List.map fst Xapi_globs.supported_bootloaders) @@ -1261,3 +1262,12 @@ debug "Refreshing software_version"; let software_version = Create_misc.make_software_version () in Db.Host.set_software_version ~__context ~self:host ~value:software_version + +let set_cpu_features ~__context ~host ~features = + debug "Set CPU features"; + () + +let reset_cpu_features ~__context ~host = + debug "Reset CPU features"; + () + diff -r ea5d2d9e7ab0 ocaml/xapi/xapi_host.mli --- a/ocaml/xapi/xapi_host.mli Thu Feb 04 10:37:18 2010 +0000 +++ b/ocaml/xapi/xapi_host.mli Thu Feb 04 14:12:33 2010 +0000 @@ -195,22 +195,22 @@ (** {2 Static VDIs} *) +(** Make the given VDIs static on the host, such that they will automatically be attached + * when xapi is restarted on this host. Supply a [reason] string for each VDI to be + * included. *) val attach_static_vdis : __context:Context.t -> host:API.ref_host -> vdi_reason_map:([ `VDI ] Ref.t * string) list -> unit -(** Make the given VDIs static on the host, such that they will automatically be attached - * when xapi is restarted on this host. Supply a [reason] string for each VDI to be - * included. *) +(** Remove the given VDIs from the list of static VDIs on the host. *) val detach_static_vdis : __context:Context.t -> host:API.ref_host -> vdis:API.ref_VDI list -> unit -(** Remove the given VDIs from the list of static VDIs on the host. *) (** {2 Local Database} *) +(** Set a key in the Local DB of the host. *) val set_localdb_key : __context:Context.t -> host:API.ref_host -> key:string -> value:string -> unit -(** Set a key in the Local DB of the host. *) (** {2 Secrets} *) @@ -218,10 +218,12 @@ val update_pool_secret : __context:'a -> host:'b -> pool_secret:string -> unit + (** {2 Supplemental Packs} *) +(** Refresh the list of Supplemental Packs in the host.software_version field. *) val refresh_pack_info : __context:Context.t -> host:API.ref_host -> unit -(** Refresh the list of Supplemental Packs in the host.software_version field. *) + (** {2 Licensing} *) @@ -233,3 +235,12 @@ * Also call this function to change to a different license server, after the * connection details in host.license_server have been amended. *) + +(** {2 CPU Feature Masking} *) + +(** Set the CPU features to be used after a reboot, if the given features string is valid. *) +val set_cpu_features : __context:Context.t -> host:API.ref_host -> features:string -> unit + +(** Remove the feature mask, such that after a reboot all features of the CPU are enabled. *) +val reset_cpu_features : __context:Context.t -> host:API.ref_host -> unit + Attachment:
flex-api _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |