Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ocaml/database/db_cache_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ let check_many_to_many () =
(* make a bar with foos = [] *)
(* add 'bar' to foo.bars *)
let db = db
|> add_row "bar" "bar:1" (Row.add 0L Db_names.ref (Schema.Value.String "bar:1") (Row.add 0L "foos" (Schema.Value.Set []) Row.empty))
|> add_row "foo" "foo:1" (Row.add 0L Db_names.ref (Schema.Value.String "foo:1") (Row.add 0L "bars" (Schema.Value.Set []) Row.empty))
|> set_field "foo" "foo:1" "bars" (add_to_set "bar:1" (Schema.Value.Set []))
|> add_row "bar" "bar:1" (Row.add 0L Db_names.ref (Schema.Value.String "bar:1") (Row.add 0L "foos" (Schema.Value.Set []) Row.empty))
|> add_row "foo" "foo:1" (Row.add 0L Db_names.ref (Schema.Value.String "foo:1") (Row.add 0L "bars" (Schema.Value.Set []) Row.empty))
|> set_field "foo" "foo:1" "bars" (add_to_set "bar:1" (Schema.Value.Set []))
in
(* check that 'bar.foos' includes 'foo' *)
let bar_1 = Table.find "bar:1" (TableSet.find "bar" (Database.tableset db)) in
Expand Down
8 changes: 4 additions & 4 deletions ocaml/database/db_cache_types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -490,13 +490,13 @@ let remove_row tblname objref db =
let g = db.Database.manifest.Manifest.generation_count in
db
|> Database.update_keymap (fun m ->
match uuid with
| Some u -> KeyMap.remove (Uuid u) m
| None -> m)
match uuid with
| Some u -> KeyMap.remove (Uuid u) m
| None -> m)
|> Database.update_keymap (KeyMap.remove (Ref objref))
|> update_many_to_many g tblname objref remove_from_set
(* Update foreign (Set(Ref _)) fields *)
(* NB this requires the original row to still exist *)
(* NB this requires the original row to still exist *)
|> update_one_to_many g tblname objref remove_from_set
|> (
Table.remove g objref
Expand Down
16 changes: 8 additions & 8 deletions ocaml/doc/jsapi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ let templdir = ref ""

let parse_args () =
Arg.parse [
"-destdir", Arg.Set_string destdir, "the destination directory for the generated files";
"-templdir", Arg.Set_string templdir, "the directory with the template (mustache) files";
]
"-destdir", Arg.Set_string destdir, "the destination directory for the generated files";
"-templdir", Arg.Set_string templdir, "the directory with the template (mustache) files";
]
(fun x-> Printf.printf "Ignoring anonymous argument %s" x)
("Generates documentation for the datamodel classes. See -help.")

Expand Down Expand Up @@ -95,10 +95,10 @@ let generate_files api_dir =

let json_releases =
let json_of_rel x = `O [
"code_name", `String (code_name_of_release x);
"version_major", `Float (float_of_int x.version_major);
"version_minor", `Float (float_of_int x.version_minor);
"branding", `String x.branding;
"code_name", `String (code_name_of_release x);
"version_major", `Float (float_of_int x.version_major);
"version_minor", `Float (float_of_int x.version_minor);
"branding", `String x.branding;
]
in
`O [ "releases", `A (List.map json_of_rel release_order) ]
Expand All @@ -108,7 +108,7 @@ let render_template template_file json output_file =
let rendered = Mustache.render templ json in
let out_chan = open_out output_file in
finally (fun () -> output_string out_chan rendered)
(fun () -> close_out out_chan)
(fun () -> close_out out_chan)


let _ =
Expand Down
66 changes: 33 additions & 33 deletions ocaml/idl/datamodel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -682,18 +682,18 @@ end

module Host_metrics = struct

let host_metrics_memory =
let field = field ~ty:Int in
[
field ~qualifier:DynamicRO "total" "Total host memory (bytes)" ~doc_tags:[Memory];
field "free" "Free host memory (bytes)"
~lifecycle:
[ Deprecated, rel_midnight_ride, "Will be disabled in favour of RRD"
; Removed, rel_tampa, "Disabled in favour of RRD"
]
~qualifier:DynamicRO
~doc_tags:[Memory];
]
let host_metrics_memory =
let field = field ~ty:Int in
[
field ~qualifier:DynamicRO "total" "Total host memory (bytes)" ~doc_tags:[Memory];
field "free" "Free host memory (bytes)"
~lifecycle:
[ Deprecated, rel_midnight_ride, "Will be disabled in favour of RRD"
; Removed, rel_tampa, "Disabled in favour of RRD"
]
~qualifier:DynamicRO
~doc_tags:[Memory];
]

let t =
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_metrics ~descr:"The metrics associated with a host" ~gen_events:true
Expand Down Expand Up @@ -955,16 +955,16 @@ module PIF = struct
()

let set_disallow_unplug = call
~name:"set_disallow_unplug"
~doc:"Set whether unplugging the PIF is allowed"
~hide_from_docs:false
~in_oss_since:None
~in_product_since:rel_orlando
~params: [ Ref _pif, "self", "Reference to the object"
; Bool, "value", "New value to set" ]
~allowed_roles:_R_POOL_OP
~errs:[Api_errors.clustering_enabled_on_network]
()
~name:"set_disallow_unplug"
~doc:"Set whether unplugging the PIF is allowed"
~hide_from_docs:false
~in_oss_since:None
~in_product_since:rel_orlando
~params: [ Ref _pif, "self", "Reference to the object"
; Bool, "value", "New value to set" ]
~allowed_roles:_R_POOL_OP
~errs:[Api_errors.clustering_enabled_on_network]
()

let ip_configuration_mode = Enum ("ip_configuration_mode",
[ "None", "Do not acquire an IP address";
Expand Down Expand Up @@ -2864,16 +2864,16 @@ module VBD = struct
()

let set_mode = call
~name:"set_mode"
~in_product_since:rel_rio
~doc:"Sets the mode of the VBD. The power_state of the VM must be halted."
~params:[
Ref _vbd, "self", "Reference to the object";
mode, "value", "New value to set";
]
~in_oss_since:None
~allowed_roles:_R_VM_ADMIN
()
~name:"set_mode"
~in_product_since:rel_rio
~doc:"Sets the mode of the VBD. The power_state of the VM must be halted."
~params:[
Ref _vbd, "self", "Reference to the object";
mode, "value", "New value to set";
]
~in_oss_since:None
~allowed_roles:_R_VM_ADMIN
()

(** A virtual disk interface *)
let t =
Expand Down Expand Up @@ -3250,7 +3250,7 @@ module VM_metrics = struct
; field ~lifecycle:[Published, rel_jura, ""] ~default_value:(Some (VEnum "unspecified"))
~ty:Datamodel_vm.domain_type ~qualifier:DynamicRO
"current_domain_type" "The current domain type of the VM (for running,\
suspended, or paused VMs). The last-known domain type for halted VMs."
suspended, or paused VMs). The last-known domain type for halted VMs."
]
()
end
Expand Down
38 changes: 19 additions & 19 deletions ocaml/idl/datamodel_cluster.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ let cluster_operation =
let lifecycle = [Prototyped, rel_kolkata, ""]

let timeout_params = [
{param_type=Float; param_name="token_timeout"; param_doc="Corosync token timeout in seconds"; param_release=kolkata_release; param_default=Some(VFloat Constants.default_token_timeout_s)};
{param_type=Float; param_name="token_timeout_coefficient"; param_doc="Corosync token timeout coefficient in seconds"; param_release=kolkata_release; param_default=Some(VFloat Constants.default_token_timeout_coefficient_s)};
]
{param_type=Float; param_name="token_timeout"; param_doc="Corosync token timeout in seconds"; param_release=kolkata_release; param_default=Some(VFloat Constants.default_token_timeout_s)};
{param_type=Float; param_name="token_timeout_coefficient"; param_doc="Corosync token timeout coefficient in seconds"; param_release=kolkata_release; param_default=Some(VFloat Constants.default_token_timeout_coefficient_s)};
]


let create = call
~name:"create"
~doc:"Creates a Cluster object and one Cluster_host object as its first member"
~result:(Ref _cluster, "the new Cluster")
~versioned_params:
([{param_type=Ref _network; param_name="network"; param_doc="the single network on which corosync carries out its inter-host communications"; param_release=kolkata_release; param_default=None};
{param_type=String; param_name="cluster_stack"; param_doc="simply the string 'corosync'. No other cluster stacks are currently supported"; param_release=kolkata_release; param_default=None};
{param_type=Bool; param_name="pool_auto_join"; param_doc="true if xapi is automatically joining new pool members to the cluster"; param_release=kolkata_release; param_default=None};
] @timeout_params)
([{param_type=Ref _network; param_name="network"; param_doc="the single network on which corosync carries out its inter-host communications"; param_release=kolkata_release; param_default=None};
{param_type=String; param_name="cluster_stack"; param_doc="simply the string 'corosync'. No other cluster stacks are currently supported"; param_release=kolkata_release; param_default=None};
{param_type=Bool; param_name="pool_auto_join"; param_doc="true if xapi is automatically joining new pool members to the cluster"; param_release=kolkata_release; param_default=None};
] @timeout_params)
~lifecycle
~allowed_roles:_R_POOL_ADMIN
()
Expand All @@ -51,9 +51,9 @@ let pool_create = call
~doc:"Attempt to create a Cluster from the entire pool"
~result:(Ref _cluster, "the new Cluster")
~versioned_params:
([{param_type=Ref _network; param_name="network"; param_doc="the single network on which corosync carries out its inter-host communications"; param_release=kolkata_release; param_default=None};
{param_type=String; param_name="cluster_stack"; param_doc="simply the string 'corosync'. No other cluster stacks are currently supported"; param_release=kolkata_release; param_default=None};
] @ timeout_params)
([{param_type=Ref _network; param_name="network"; param_doc="the single network on which corosync carries out its inter-host communications"; param_release=kolkata_release; param_default=None};
{param_type=String; param_name="cluster_stack"; param_doc="simply the string 'corosync'. No other cluster stacks are currently supported"; param_release=kolkata_release; param_default=None};
] @ timeout_params)
~lifecycle
~allowed_roles:_R_POOL_ADMIN
()
Expand All @@ -79,12 +79,12 @@ let pool_destroy = call
()

let pool_resync = call
~name:"pool_resync"
~doc:"Resynchronise the cluster_host objects across the pool. Creates them where they need creating and then plugs them"
~params:[ Ref _cluster, "self", "The cluster to resync"]
~lifecycle
~allowed_roles:_R_POOL_ADMIN
()
~name:"pool_resync"
~doc:"Resynchronise the cluster_host objects across the pool. Creates them where they need creating and then plugs them"
~params:[ Ref _cluster, "self", "The cluster to resync"]
~lifecycle
~allowed_roles:_R_POOL_ADMIN
()

let t =
create_obj
Expand Down Expand Up @@ -119,15 +119,15 @@ let t =

] @ (allowed_and_current_operations cluster_operation) @ [

field ~qualifier:StaticRO ~lifecycle
field ~qualifier:StaticRO ~lifecycle
~ty:Bool "pool_auto_join" ~default_value:(Some (VBool true))
"True if xapi is automatically joining new pool members to the cluster. This will be `true` in the first release"

; field ~qualifier:StaticRO ~lifecycle
; field ~qualifier:StaticRO ~lifecycle
~ty:Int "token_timeout" ~default_value:(Some (VInt 20000L))
"The corosync token timeout in ms"

; field ~qualifier:StaticRO ~lifecycle
; field ~qualifier:StaticRO ~lifecycle
~ty:Int "token_timeout_coefficient" ~default_value:(Some (VInt 1000L))
"The corosync token timeout coefficient in ms"

Expand Down
4 changes: 2 additions & 2 deletions ocaml/idl/datamodel_cluster_host.ml
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ let t =

(* TODO: add `live` member to represent whether corosync believes that this
cluster host actually is enabled *)

] @ (allowed_and_current_operations cluster_host_operation) @ [

field ~qualifier:StaticRO ~lifecycle
field ~qualifier:StaticRO ~lifecycle
~ty:(Map(String, String)) "other_config" ~default_value:(Some (VMap []))
"Additional configuration"
])
Expand Down
Loading