Skip to content

Commit

Permalink
When reseting an host network: keep the primary address type
Browse files Browse the repository at this point in the history
By default when recreating the PIF etc the address type is IPv4
Look what it was before and reput it after the PIF recreation

Signed-off-by: Benjamin Reis <[email protected]>
  • Loading branch information
benjamreis committed Sep 24, 2024
1 parent f51e7e7 commit f2fb4c4
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 f2fb4c4

Please sign in to comment.