Skip to content

Commit bbc37f6

Browse files
thomassagaborigloi
authored andcommitted
CP-24903: Rename Network.purposes to purpose
This is for consistency. Now the add/remove functions that would be autogenerated if the field were RW would themselves have names ending "purpose", and therefore would be the same as the hand-written add/remove functions that add and remove a single purpose. (Before this change, the hypothetical autogenerated functions would have been "add/remove_purposes" even though they add/remove only a single purpose.) Signed-off-by: Thomas Sanders <[email protected]>
1 parent b84081f commit bbc37f6

File tree

12 files changed

+30
-30
lines changed

12 files changed

+30
-30
lines changed

ocaml/idl/datamodel.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5207,7 +5207,7 @@ let network_introduce_params first_rel =
52075207
{param_type=Map(String,String); param_name="other_config"; param_doc=""; param_release=first_rel; param_default=None};
52085208
{param_type=String; param_name="bridge"; param_doc=""; param_release=first_rel; param_default=None};
52095209
{param_type=Bool; param_name="managed"; param_doc=""; param_release=falcon_release; param_default=None};
5210-
{param_type=Set(network_purpose); param_name="purposes"; param_doc=""; param_release=inverness_release; param_default=None};
5210+
{param_type=Set(network_purpose); param_name="purpose"; param_doc=""; param_release=inverness_release; param_default=None};
52115211
]
52125212

52135213
(* network pool introduce is used to copy network records on pool join -- it's the network analogue of VDI/PIF.pool_introduce *)
@@ -5317,7 +5317,7 @@ let network =
53175317
field ~writer_roles:_R_VM_OP ~in_product_since:rel_orlando ~default_value:(Some (VSet [])) ~ty:(Set String) "tags" "user-specified tags for categorization purposes";
53185318
field ~qualifier:DynamicRO ~in_product_since:rel_tampa ~default_value:(Some (VEnum "unlocked")) ~ty:network_default_locking_mode "default_locking_mode" "The network will use this value to determine the behaviour of all VIFs where locking_mode = default";
53195319
field ~qualifier:DynamicRO ~in_product_since:rel_creedence ~default_value:(Some (VMap [])) ~ty:(Map (Ref _vif, String)) "assigned_ips" "The IP addresses assigned to VIFs on networks that have active xapi-managed DHCP";
5320-
field ~qualifier:StaticRO ~in_product_since:rel_inverness ~default_value:(Some (VSet [])) ~ty:(Set network_purpose) "purposes" "Set of purposes for which the server will use this network";
5320+
field ~qualifier:StaticRO ~in_product_since:rel_inverness ~default_value:(Some (VSet [])) ~ty:(Set network_purpose) "purpose" "Set of purposes for which the server will use this network";
53215321
])
53225322
()
53235323

ocaml/perftest/createpool.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ let initialise session_id template pool =
5151
let networks_to_create = pool.interfaces_per_host - pool.bonds in
5252
debug "Creating %d networks..." networks_to_create;
5353
let networks = Array.init networks_to_create (fun i ->
54-
Client.Network.create ~rpc ~session_id ~name_label:(Printf.sprintf "perftestnet%d" i) ~name_description:"" ~mTU:1500L ~other_config:[oc_key,pool.key] ~bridge:"" ~managed:true ~tags:[] ~purposes:[])
54+
Client.Network.create ~rpc ~session_id ~name_label:(Printf.sprintf "perftestnet%d" i) ~name_description:"" ~mTU:1500L ~other_config:[oc_key,pool.key] ~bridge:"" ~managed:true ~tags:[] ~purpose:[])
5555
in
5656

5757
(* Set up the template - create the VIFs *)

ocaml/xapi/create_networks.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ let create_guest_installer_network ~__context =
4040
let h' = Xapi_network.create ~__context ~name_label:internal_management_network_name
4141
~name_description:internal_management_network_desc ~mTU:1500L
4242
~other_config:internal_management_network_oc ~bridge:"" ~managed:true ~tags:[]
43-
~purposes:[] in
43+
~purpose:[] in
4444
Db.Network.set_bridge ~__context ~self:h' ~value:internal_management_bridge;
4545
debug "Created new host internal management network: %s" (Ref.string_of h')
4646

ocaml/xapi/dbsync_slave.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,12 @@ let record_host_memory_properties ~__context =
183183
~current_operations:[] ~allowed_operations:[]
184184
~name_label:"Test uniqueness constraint"
185185
~name_description:"Testing"
186-
~bridge:"bridge" ~other_config:[] ~purposes:[];
186+
~bridge:"bridge" ~other_config:[] ~purpose:[];
187187
Db.Network.create ~__context ~ref:(Ref.make()) ~uuid:duplicate_uuid
188188
~current_operations:[] ~allowed_operations:[]
189189
~name_label:"Test uniqueness constraint"
190190
~name_description:"Testing"
191-
~bridge:"bridge" ~other_config:[] ~purposes:[];
191+
~bridge:"bridge" ~other_config:[] ~purpose:[];
192192
()
193193
*)
194194

ocaml/xapi/debug_populate.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let rec make_networks __context i =
3434
else
3535
begin
3636
let nw_ref = Xapi_network.create ~__context ~name_label:("Network-"^(string_of_int i)) ~name_description:"dummy"
37-
~mTU:1500L ~other_config:[] ~bridge:"" ~managed:true ~tags:[] ~purposes:[] in
37+
~mTU:1500L ~other_config:[] ~bridge:"" ~managed:true ~tags:[] ~purpose:[] in
3838
nws := nw_ref :: !nws;
3939
make_networks __context (i-1)
4040
end

ocaml/xapi/records.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,8 @@ let net_record rpc session_id net =
445445
(Record_util.string_to_network_default_locking_mode value)) ();
446446

447447
make_field ~name:"purposes"
448-
~get:(fun () -> (x ()).API.network_purposes |> List.map Record_util.network_purpose_to_string |> (String.concat ", "))
449-
~get_set:(fun () -> (x ()).API.network_purposes |> List.map Record_util.network_purpose_to_string)
448+
~get:(fun () -> (x ()).API.network_purpose |> List.map Record_util.network_purpose_to_string |> (String.concat ", "))
449+
~get_set:(fun () -> (x ()).API.network_purpose |> List.map Record_util.network_purpose_to_string)
450450
~add_to_set:(fun s -> Client.Network.add_purpose rpc session_id net
451451
(Record_util.string_to_network_purpose s))
452452
~remove_from_set:(fun s -> Client.Network.remove_purpose rpc session_id net

ocaml/xapi/test_common.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ let make_pif ~__context ~network ~host ?(device="eth0") ?(mAC="C0:FF:EE:C0:FF:EE
162162
~ipv6_configuration_mode ~iPv6 ~ipv6_gateway ~primary_address_type ~managed ~properties
163163

164164
let make_network ~__context ?(name_label="net") ?(name_description="description") ?(mTU=1500L)
165-
?(other_config=[]) ?(bridge="xenbr0") ?(managed=true) ?(purposes=[]) () =
166-
Xapi_network.pool_introduce ~__context ~name_label ~name_description ~mTU ~other_config ~bridge ~managed ~purposes
165+
?(other_config=[]) ?(bridge="xenbr0") ?(managed=true) ?(purpose=[]) () =
166+
Xapi_network.pool_introduce ~__context ~name_label ~name_description ~mTU ~other_config ~bridge ~managed ~purpose
167167

168168
let make_vif ~__context ?(ref=Ref.make ()) ?(uuid=make_uuid ())
169169
?(current_operations=[]) ?(allowed_operations=[]) ?(reserved=false)

ocaml/xapi/xapi.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ let check_network_reset () =
533533
match existing_network with
534534
| None ->
535535
let name_label = Printf.sprintf "Pool-wide network associated with %s on VLAN%s" device vlan in
536-
Xapi_network.create ~__context ~name_label ~name_description:"" ~mTU:1500L ~other_config:[] ~bridge:"" ~managed:true ~tags:[] ~purposes:[]
536+
Xapi_network.create ~__context ~name_label ~name_description:"" ~mTU:1500L ~other_config:[] ~bridge:"" ~managed:true ~tags:[] ~purpose:[]
537537
| Some network -> network
538538
in
539539
let vlan, untagged_PIF = Xapi_vlan.create_internal ~__context ~host ~tagged_PIF:pif

ocaml/xapi/xapi_network.ml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ let counter = ref 0
185185
let mutex = Mutex.create ()
186186
let stem = "xapi"
187187

188-
let pool_introduce ~__context ~name_label ~name_description ~mTU ~other_config ~bridge ~managed ~purposes =
188+
let pool_introduce ~__context ~name_label ~name_description ~mTU ~other_config ~bridge ~managed ~purpose =
189189
let r = Ref.make() and uuid = Uuid.make_uuid() in
190190
Db.Network.create ~__context ~ref:r ~uuid:(Uuid.to_string uuid)
191-
~current_operations:[] ~allowed_operations:[] ~purposes
191+
~current_operations:[] ~allowed_operations:[] ~purpose
192192
~name_label ~name_description ~mTU ~bridge ~managed
193193
~other_config ~blobs:[] ~tags:[] ~default_locking_mode:`unlocked ~assigned_ips:[];
194194
r
@@ -201,7 +201,7 @@ let rec choose_bridge_name bridges =
201201
else
202202
name
203203

204-
let create ~__context ~name_label ~name_description ~mTU ~other_config ~bridge ~managed ~tags ~purposes =
204+
let create ~__context ~name_label ~name_description ~mTU ~other_config ~bridge ~managed ~tags ~purpose =
205205
Mutex.execute mutex (fun () ->
206206
let networks = Db.Network.get_all ~__context in
207207
let bridges = List.map (fun self -> Db.Network.get_bridge ~__context ~self) networks in
@@ -227,7 +227,7 @@ let create ~__context ~name_label ~name_description ~mTU ~other_config ~bridge ~
227227
Db.Network.create ~__context ~ref:r ~uuid:(Uuid.to_string uuid)
228228
~current_operations:[] ~allowed_operations:[]
229229
~name_label ~name_description ~mTU ~bridge ~managed
230-
~other_config ~blobs:[] ~tags ~purposes ~default_locking_mode:`unlocked ~assigned_ips:[];
230+
~other_config ~blobs:[] ~tags ~purpose ~default_locking_mode:`unlocked ~assigned_ips:[];
231231
r
232232
)
233233

@@ -342,7 +342,7 @@ let assert_can_add_purpose ~__context ~network ~current newval =
342342
* type doesn't allow searching for a value inside a list. *)
343343
Db.Network.get_all ~__context |>
344344
List.iter (fun nwk ->
345-
Db.Network.get_purposes ~__context ~self:nwk |>
345+
Db.Network.get_purpose ~__context ~self:nwk |>
346346
List.iter (fun suspect -> if (List.mem suspect bads) then
347347
info "Cannot set new network purpose %s when there is a network with purpose %s" (sop newval) (sop suspect);
348348
reject (sop suspect)
@@ -354,15 +354,15 @@ let assert_can_add_purpose ~__context ~network ~current newval =
354354
| `insecure_nbd -> assert_no_net_has_bad_porpoise [`nbd]
355355

356356
let add_purpose ~__context ~self ~value =
357-
let current = Db.Network.get_purposes ~__context ~self in
357+
let current = Db.Network.get_purpose ~__context ~self in
358358
if not (List.mem value current) then (
359359
assert_can_add_purpose ~__context ~network:self ~current value;
360-
Db.Network.set_purposes ~__context ~self ~value:(value::current)
360+
Db.Network.set_purpose ~__context ~self ~value:(value::current)
361361
)
362362

363363
let remove_purpose ~__context ~self ~value =
364-
let current = Db.Network.get_purposes ~__context ~self in
364+
let current = Db.Network.get_purpose ~__context ~self in
365365
if (List.mem value current) then (
366366
let porpoises = List.filter ((<>) value) current in
367-
Db.Network.set_purposes ~__context ~self ~value:(porpoises)
367+
Db.Network.set_purpose ~__context ~self ~value:(porpoises)
368368
)

ocaml/xapi/xapi_network.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ val pool_introduce :
7373
other_config:(string * string) list ->
7474
bridge:string ->
7575
managed:bool ->
76-
purposes:API.network_purpose list ->
76+
purpose:API.network_purpose list ->
7777
[ `network ] Ref.t
7878

7979
(** Attempt to create a bridge with a unique name *)
@@ -86,7 +86,7 @@ val create :
8686
bridge:string ->
8787
managed:bool ->
8888
tags:string list ->
89-
purposes:API.network_purpose list ->
89+
purpose:API.network_purpose list ->
9090
[ `network ] Ref.t
9191

9292
(** WARNING WARNING WARNING: called with the master dispatcher lock; do nothing but basic DB calls

0 commit comments

Comments
 (0)