Skip to content

Commit d45bded

Browse files
committed
CP-53614: Use get_all to get net interfaces
Some devices like ibft may not be in networkd sort result but need to build pif, network for it. So the devices need be got by `get_all`. Signed-off-by: Changlei Li <[email protected]>
1 parent 27d5d7e commit d45bded

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ocaml/xapi/xapi_pif.ml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,14 @@ let make_tables ~__context ~host =
370370
let dbg = Context.string_of_task __context in
371371
let device_to_position_table = Net.Interface.get_interface_positions dbg () in
372372
let device_to_mac_table =
373-
List.map
374-
(fun (name, _) -> (name, Net.Interface.get_mac dbg name))
375-
device_to_position_table
373+
List.filter_map
374+
(fun name ->
375+
if Net.Interface.is_physical dbg name then
376+
Some (name, Net.Interface.get_mac dbg name)
377+
else
378+
None
379+
)
380+
(Net.Interface.get_all dbg ())
376381
in
377382
(* Get all PIFs on this host *)
378383
let pif_to_device_table =

0 commit comments

Comments
 (0)