Skip to content

Commit e7430c7

Browse files
committed
idl: Rename pool_allowed_operations to pool_operations
This commit addresses a fixme in idl/datamodel_pool.ml. The name pool_allowed_operations conflicts with field Pool.allowed_operations, so renaming for clarity. Signed-off-by: Christian Pardillo Laursen <christian.pardillolaursen@citrix.com>
1 parent 9de38ef commit e7430c7

File tree

7 files changed

+16
-18
lines changed

7 files changed

+16
-18
lines changed

ocaml/idl/datamodel_common.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ open Datamodel_roles
1010
to leave a gap for potential hotfixes needing to increment the schema version.*)
1111
let schema_major_vsn = 5
1212

13-
let schema_minor_vsn = 791
13+
let schema_minor_vsn = 792
1414

1515
(* Historical schema versions just in case this is useful later *)
1616
let rio_schema_major_vsn = 5

ocaml/idl/datamodel_pool.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ open Datamodel_types
44

55
let operations =
66
Enum
7-
( "pool_allowed_operations"
8-
, (* FIXME: This should really be called `pool_operations`, to avoid confusion with the Pool.allowed_operations field *)
9-
[
7+
( "pool_operations"
8+
, [
109
("ha_enable", "Indicates this pool is in the process of enabling HA")
1110
; ("ha_disable", "Indicates this pool is in the process of disabling HA")
1211
; ( "cluster_create"

ocaml/idl/schematest.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ let hash x = Digest.string x |> Digest.to_hex
33
(* BEWARE: if this changes, check that schema has been bumped accordingly in
44
ocaml/idl/datamodel_common.ml, usually schema_minor_vsn *)
55

6-
let last_known_schema_hash = "3b20f4304cfaaa7b6213af91ae632e64"
6+
let last_known_schema_hash = "eceed401894f1aa22ba0fc41e08113c1"
77

88
let current_schema_hash : string =
99
let open Datamodel_types in

ocaml/tests/record_util/test_record_util.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ let tests =
133133
, N.pool_guest_secureboot_readiness_to_string
134134
)
135135
; mk __LINE__ None all_pool_allowed_operations
136-
(O.pool_operation_to_string, N.pool_allowed_operations_to_string)
136+
(O.pool_operation_to_string, N.pool_operations_to_string)
137137
; mk __LINE__ None all_host_allowed_operations
138138
(O.host_operation_to_string, N.host_operation_to_string)
139139
; mk __LINE__ None all_update_guidances

ocaml/xapi-cli-server/records.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,23 +1222,23 @@ let pool_record rpc session_id pool =
12221222
()
12231223
; make_field ~name:"allowed-operations"
12241224
~get:(fun () ->
1225-
map_and_concat Record_util.pool_allowed_operations_to_string
1225+
map_and_concat Record_util.pool_operations_to_string
12261226
(x ()).API.pool_allowed_operations
12271227
)
12281228
~get_set:(fun () ->
1229-
List.map Record_util.pool_allowed_operations_to_string
1229+
List.map Record_util.pool_operations_to_string
12301230
(x ()).API.pool_allowed_operations
12311231
)
12321232
()
12331233
; make_field ~name:"current-operations"
12341234
~get:(fun () ->
12351235
map_and_concat
1236-
(fun (_, b) -> Record_util.pool_allowed_operations_to_string b)
1236+
(fun (_, b) -> Record_util.pool_operations_to_string b)
12371237
(x ()).API.pool_current_operations
12381238
)
12391239
~get_set:(fun () ->
12401240
List.map
1241-
(fun (_, b) -> Record_util.pool_allowed_operations_to_string b)
1241+
(fun (_, b) -> Record_util.pool_operations_to_string b)
12421242
(x ()).API.pool_current_operations
12431243
)
12441244
()

ocaml/xapi/xapi_pool_helpers.ml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type waiting_operations =
4242
type all_operations = [blocking_operations | waiting_operations]
4343

4444
(* Unused, ensure every API operation is statically partitioned here. *)
45-
let _id (op : API.pool_allowed_operations) : all_operations = op
45+
let _id (op : API.pool_operations) : all_operations = op
4646

4747
(* psr is not included as a pool op because it can be considered in progress
4848
in between api calls (i.e. wrapping it inside with_pool_operation won't work) *)
@@ -97,7 +97,7 @@ type validity = Unknown | Allowed | Disallowed of string * string list
9797
element of all_operations to a value indicating whether it would be
9898
valid for it to be executed in the inputted execution context. *)
9999
let compute_valid_operations ~__context record pool :
100-
API.pool_allowed_operations -> validity =
100+
API.pool_operations -> validity =
101101
let ref = Ref.string_of pool in
102102
let current_ops = record.Db_actions.pool_current_operations in
103103
let table = (Hashtbl.create 32 : (all_operations, validity) Hashtbl.t) in
@@ -122,7 +122,7 @@ let compute_valid_operations ~__context record pool :
122122
let additional_info =
123123
match waiting_op with
124124
| Some (op_ref, op_type) ->
125-
[API.pool_allowed_operations_to_string op_type; op_ref]
125+
[API.pool_operations_to_string op_type; op_ref]
126126
| _ ->
127127
[]
128128
in
@@ -202,8 +202,7 @@ let compute_valid_operations ~__context record pool :
202202
) ;
203203
fun op -> Hashtbl.find_opt table op |> Option.value ~default:Unknown
204204

205-
let assert_operation_valid ~__context ~self ~(op : API.pool_allowed_operations)
206-
=
205+
let assert_operation_valid ~__context ~self ~(op : API.pool_operations) =
207206
(* No pool operations allowed during a pending PSR. *)
208207
if Db.Pool.get_is_psr_pending ~__context ~self:(Helpers.get_pool ~__context)
209208
then
@@ -218,7 +217,7 @@ let assert_operation_valid ~__context ~self ~(op : API.pool_allowed_operations)
218217
| Unknown ->
219218
(* This should never happen and implies our validity algorithm is incomplete. *)
220219
let detail =
221-
let op = pool_allowed_operations_to_string op in
220+
let op = pool_operations_to_string op in
222221
Printf.sprintf "%s.%s unknown operation: %s" __MODULE__ __FUNCTION__ op
223222
in
224223
raise Api_errors.(Server_error (internal_error, [detail]))
@@ -269,7 +268,7 @@ let assert_no_pool_ops ~__context =
269268
let err =
270269
ops
271270
|> List.map snd
272-
|> List.map Record_util.pool_allowed_operations_to_string
271+
|> List.map Record_util.pool_operations_to_string
273272
|> String.concat "; "
274273
|> Printf.sprintf "pool operations in progress: [ %s ]"
275274
in

ocaml/xapi/xapi_pool_helpers.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ val with_pool_operation :
2020
__context:Context.t
2121
-> self:API.ref_pool
2222
-> doc:string
23-
-> op:API.pool_allowed_operations
23+
-> op:API.pool_operations
2424
-> (unit -> 'a)
2525
-> 'a
2626

0 commit comments

Comments
 (0)