From adc6a5c864f14065afb54de13ab1add8ac10cef3 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Fri, 20 Sep 2024 08:26:40 +0200 Subject: [PATCH] When reseting an host network: keep the primary address type 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 --- ocaml/xapi/xapi.ml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ocaml/xapi/xapi.ml b/ocaml/xapi/xapi.ml index b702001ef2..b490b0c2f1 100644 --- a/ocaml/xapi/xapi.ml +++ b/ocaml/xapi/xapi.ml @@ -737,6 +737,14 @@ let check_network_reset () = | [] -> error "management PIF %s not found" device | phy_pif :: _ -> + (* Keep previsous management address type *) + let management_address_type = + Record_util.primary_address_type_of_string + (Xapi_inventory.lookup Xapi_inventory._management_address_type) + in + Xapi_host.management_disable ~__context ; + Xapi_pif.set_primary_address_type ~__context ~self:phy_pif + ~primary_address_type:management_address_type ; let pif = match vlan with | Some vlan ->