Skip to content

Commit

Permalink
Determine IP address type from inventory when creating a PIF
Browse files Browse the repository at this point in the history
Do not assume IPv4 instead see what's in the inventory's
`MANAGEMENT_ADDRESS_TYPE`.

Signed-off-by: Benjamin Reis <[email protected]>
  • Loading branch information
benjamreis committed Sep 24, 2024
1 parent f51e7e7 commit 4fcb2f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ocaml/xapi/xapi_pif.ml
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,10 @@ let introduce_internal ?network ?(physical = true) ~t:_ ~__context ~host ~mAC
let capabilities = Net.Interface.get_capabilities dbg device in
let pci = get_device_pci ~__context ~host ~device in
let pif = Ref.make () in
let primary_address_type =
Record_util.primary_address_type_of_string
(Xapi_inventory.lookup Xapi_inventory._management_address_type)
in
debug "Creating a new record for NIC: %s: %s" device (Ref.string_of pif) ;
let () =
Db.PIF.create ~__context ~ref:pif
Expand All @@ -485,7 +489,7 @@ let introduce_internal ?network ?(physical = true) ~t:_ ~__context ~host ~mAC
~netmask:"" ~gateway:"" ~dNS:"" ~bond_slave_of:Ref.null ~vLAN_master_of
~management:false ~other_config:[] ~disallow_unplug
~ipv6_configuration_mode:`None ~iPv6:[] ~ipv6_gateway:""
~primary_address_type:`IPv4 ~managed ~properties:default_properties
~primary_address_type ~managed ~properties:default_properties
~capabilities ~pCI:pci
in
(* If I'm a pool slave and this pif represents my management
Expand Down

0 comments on commit 4fcb2f3

Please sign in to comment.