Skip to content

Commit 84ecb1e

Browse files
committed
CA-410948 Avoid rasie full Exception when disable/enable ssh failed
- Refine the exception when host.enable_ssh/host.disable_ssh failed - Reset the host.ssh_expiry to default when host.enabl_ssh with no timeout Signed-off-by: Lunfan Zhang[Lunfan.Zhang] <[email protected]>
1 parent 779f8f7 commit 84ecb1e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ocaml/xapi/xapi_host.ml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3121,7 +3121,8 @@ let disable_ssh_internal ~__context ~self =
31213121
with e ->
31223122
error "Failed to disable SSH for host %s: %s" (Ref.string_of self)
31233123
(Printexc.to_string e) ;
3124-
Helpers.internal_error "Failed to disable SSH: %s" (Printexc.to_string e)
3124+
Helpers.internal_error "Failed to disable SSH access, host: %s"
3125+
(Ref.string_of self)
31253126

31263127
let schedule_disable_ssh_job ~__context ~self ~timeout =
31273128
let host_uuid = Helpers.get_localhost_uuid () in
@@ -3168,7 +3169,8 @@ let enable_ssh ~__context ~self =
31683169
( match timeout with
31693170
| 0L ->
31703171
Xapi_stdext_threads_scheduler.Scheduler.remove_from_queue
3171-
!Xapi_globs.job_for_disable_ssh
3172+
!Xapi_globs.job_for_disable_ssh ;
3173+
Db.Host.set_ssh_expiry ~__context ~self ~value:Date.epoch
31723174
| t ->
31733175
schedule_disable_ssh_job ~__context ~self ~timeout:t
31743176
) ;
@@ -3177,7 +3179,8 @@ let enable_ssh ~__context ~self =
31773179
with e ->
31783180
error "Failed to enable SSH on host %s: %s" (Ref.string_of self)
31793181
(Printexc.to_string e) ;
3180-
Helpers.internal_error "Failed to enable SSH: %s" (Printexc.to_string e)
3182+
Helpers.internal_error "Failed to enable SSH access, host: %s"
3183+
(Ref.string_of self)
31813184

31823185
let disable_ssh ~__context ~self =
31833186
Xapi_stdext_threads_scheduler.Scheduler.remove_from_queue

0 commit comments

Comments
 (0)