From 29685fb2c388f562ac337f32e885667ab33a57cc Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Tue, 24 Sep 2024 13:59:59 +0200 Subject: [PATCH] Do not assume IPv4 when disabling management Instead look at the inventory to decide the address type, this will avoid to override the value in the inventory when its rewritten Signed-off-by: Benjamin Reis --- ocaml/xapi/xapi_host.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ocaml/xapi/xapi_host.ml b/ocaml/xapi/xapi_host.ml index aa2f07e2fba..e8162430943 100644 --- a/ocaml/xapi/xapi_host.ml +++ b/ocaml/xapi/xapi_host.ml @@ -1303,7 +1303,11 @@ let management_disable ~__context = raise (Api_errors.Server_error (Api_errors.slave_requires_management_iface, [])) ; (* Reset the management server *) - Xapi_mgmt_iface.change "" `IPv4 ; + let management_address_type = + Record_util.primary_address_type_of_string + Xapi_inventory.(lookup _management_address_type) + in + Xapi_mgmt_iface.change "" management_address_type ; Xapi_mgmt_iface.run ~__context ~mgmt_enabled:false () ; (* Make sure all my PIFs are marked appropriately *) Xapi_pif.update_management_flags ~__context