Skip to content

Commit 87ca449

Browse files
committed
xapi-aux: remove cstruct usage from networking_info
The only use of it was a parameter that was not used anywhere Signed-off-by: Pau Ruiz Safont <[email protected]>
1 parent bd5fe18 commit 87ca449

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

ocaml/xapi-aux/networking_info.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ let ipaddr_to_octets = function
6161
| Ipaddr.V6 addr ->
6262
Ipaddr.V6.to_octets addr
6363

64-
let ipaddr_to_cstruct c = ipaddr_to_octets c |> Cstruct.of_string
65-
6664
let get_management_ip_addrs ~dbg =
6765
let iface = Inventory.lookup Inventory._management_interface in
6866
try
@@ -101,8 +99,7 @@ let get_management_ip_addrs ~dbg =
10199
let get_management_ip_addr ~dbg =
102100
match get_management_ip_addrs ~dbg with
103101
| Ok (preferred, _) ->
104-
List.nth_opt preferred 0
105-
|> Option.map (fun addr -> (Ipaddr.to_string addr, ipaddr_to_cstruct addr))
102+
List.nth_opt preferred 0 |> Option.map Ipaddr.to_string
106103
| Error _ ->
107104
None
108105

ocaml/xapi-aux/networking_info.mli

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ val management_ip_error_to_string : management_ip_error -> string
2424
(** [management_ip_error err] returns a string representation of [err], useful
2525
only for logging. *)
2626

27-
val get_management_ip_addr : dbg:string -> (string * Cstruct.t) option
27+
val get_management_ip_addr : dbg:string -> string option
2828
(** [get_management_ip_addr ~dbg] returns the preferred IP of the management
29-
network, or None. The address is returned in two formats: a human-readable
30-
string and its bytes representation. *)
29+
network, or None. The address is returned in a human-readable string *)
3130

3231
val get_host_certificate_subjects :
3332
dbg:string

ocaml/xapi/helpers.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ let get_management_iface_is_connected ~__context =
157157

158158
let get_management_ip_addr ~__context =
159159
let dbg = Context.string_of_task __context in
160-
Option.map fst (Networking_info.get_management_ip_addr ~dbg)
160+
Networking_info.get_management_ip_addr ~dbg
161161

162162
let get_localhost_uuid () =
163163
Xapi_inventory.lookup Xapi_inventory._installation_uuid

0 commit comments

Comments
 (0)