From 0c5d12120e1dafed4de5c58bbcb716b6f6dbc016 Mon Sep 17 00:00:00 2001 From: "Lunfan Zhang[Lunfan.Zhang]" Date: Mon, 7 Jul 2025 02:42:08 +0000 Subject: [PATCH] CA-413328 Enable auto-mode when XAPI failed for a extend period that exceeds the timeout duration Signed-off-by: Lunfan Zhang[Lunfan.Zhang] --- ocaml/xapi/xapi_periodic_scheduler_init.ml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ocaml/xapi/xapi_periodic_scheduler_init.ml b/ocaml/xapi/xapi_periodic_scheduler_init.ml index ff7c3187c20..e238e9daa62 100644 --- a/ocaml/xapi/xapi_periodic_scheduler_init.ml +++ b/ocaml/xapi/xapi_periodic_scheduler_init.ml @@ -91,9 +91,14 @@ let register ~__context = let remaining = Int64.sub expiry_time current_time in Xapi_host.schedule_disable_ssh_job ~__context ~self ~timeout:remaining ~auto_mode:true - (* handle the case where XAPI is not active when the SSH timeout expires *) - else if Fe_systemctl.is_active ~service:!Xapi_globs.ssh_service then - Xapi_host.disable_ssh ~__context ~self + (* Handle the case where XAPI is not active when the SSH timeout expires. + This typically occurs when XAPI has been down for an extended period that + exceeds the timeout duration. In this scenario, we need to enable SSH auto + mode to ensure the SSH service remains continuously available. *) + else if Fe_systemctl.is_active ~service:!Xapi_globs.ssh_service then ( + Xapi_host.disable_ssh ~__context ~self ; + Xapi_host.set_ssh_auto_mode ~__context ~self ~value:true + ) in let update_all_subjects_delay = 10.0 in (* initial delay = 10 seconds *)