# HG changeset patch # User Rob Hoes Expose pool-level restrictions Add a Pool.restrictions field that reflects which features are enabled on the pool. Signed-off-by: Rob Hoes diff -r 54aa9c0cd3cb ocaml/idl/datamodel.ml --- a/ocaml/idl/datamodel.ml Mon Feb 01 17:05:48 2010 +0000 +++ b/ocaml/idl/datamodel.ml Mon Feb 01 17:09:16 2010 +0000 @@ -5085,6 +5085,7 @@ ; field ~in_oss_since:None ~in_product_since:rel_midnight_ride ~qualifier:DynamicRO ~ty:Bool ~default_value:(Some (VBool false)) "redo_log_enabled" "true a redo-log is to be used other than when HA is enabled, false otherwise" ; field ~in_oss_since:None ~in_product_since:rel_midnight_ride ~qualifier:DynamicRO ~ty:(Ref _vdi) ~default_value:(Some (VRef (Ref.string_of Ref.null))) "redo_log_vdi" "indicates the VDI to use for the redo-log other than when HA is enabled" ; field ~in_oss_since:None ~in_product_since:rel_midnight_ride ~qualifier:DynamicRO ~ty:String ~default_value:(Some (VString "")) "vswitch_controller" "address of the vswitch controller" + ; field ~in_oss_since:None ~in_product_since:rel_midnight_ride ~qualifier:DynamicRO ~ty:(Map(String, String)) ~default_value:(Some (VMap [])) "restrictions" "Pool-wide restrictions currently in effect" ] () diff -r 54aa9c0cd3cb ocaml/license/restrictions.ml --- a/ocaml/license/restrictions.ml Mon Feb 01 17:05:48 2010 +0000 +++ b/ocaml/license/restrictions.ml Mon Feb 01 17:09:16 2010 +0000 @@ -255,7 +255,10 @@ info "Old pool restrictions: %s" (to_compact_string !pool_restrictions); info "New pool restrictions: %s" (to_compact_string new_restrictions); pool_restrictions := new_restrictions - end) + end; + let pool = List.hd (Db.Pool.get_all ~__context) in + Db.Pool.set_restrictions ~__context ~self:pool ~value:(to_assoc_list new_restrictions) + ) let license_ok_for_wlb ~__context = (get_pool()).enable_wlb diff -r 54aa9c0cd3cb ocaml/license/restrictions.mli --- a/ocaml/license/restrictions.mli Mon Feb 01 17:05:48 2010 +0000 +++ b/ocaml/license/restrictions.mli Mon Feb 01 17:09:16 2010 +0000 @@ -72,7 +72,7 @@ (* called by xapi_host *) (** Called whenever a slave resets its Host.license_params after reading in a license. *) -val update_pool_restrictions : __context:'a -> unit +val update_pool_restrictions : __context:Context.t -> unit (** Object the {!restrictions} for a given {!sku}. *) val restrictions_of_sku : sku -> restrictions diff -r 54aa9c0cd3cb ocaml/xapi/dbsync_master.ml --- a/ocaml/xapi/dbsync_master.ml Mon Feb 01 17:05:48 2010 +0000 +++ b/ocaml/xapi/dbsync_master.ml Mon Feb 01 17:09:16 2010 +0000 @@ -33,7 +33,7 @@ ~ha_enabled:false ~ha_configuration:[] ~ha_statefiles:[] ~ha_host_failures_to_tolerate:0L ~ha_plan_exists_for:0L ~ha_allow_overcommit:false ~ha_overcommitted:false ~blobs:[] ~tags:[] ~gui_config:[] ~wlb_url:"" ~wlb_username:"" ~wlb_password:Ref.null ~wlb_enabled:false ~wlb_verify_cert:false - ~redo_log_enabled:false ~redo_log_vdi:Ref.null ~vswitch_controller:"" + ~redo_log_enabled:false ~redo_log_vdi:Ref.null ~vswitch_controller:"" ~restrictions:[] ~other_config:[ Xapi_globs.memory_ratio_hvm; Xapi_globs.memory_ratio_pv;