@@ -943,6 +943,40 @@ let rec create_or_get_host_on_master __context rpc session_id (host_ref, host) :
943943 create_or_get_sr_on_master __context rpc session_id
944944 (my_local_cache_sr, my_local_cache_sr_rec)
945945 in
946+ let remote_coordinator = get_master ~rpc ~session_id in
947+ let ssh_enabled =
948+ Client.Host. get_ssh_enabled ~rpc ~session_id ~self: remote_coordinator
949+ in
950+ let ssh_enabled_timeout =
951+ Client.Host. get_ssh_enabled_timeout ~rpc ~session_id
952+ ~self: remote_coordinator
953+ in
954+ let console_idle_timeout =
955+ Client.Host. get_console_idle_timeout ~rpc ~session_id
956+ ~self: remote_coordinator
957+ in
958+ (* Configure SSH service parameters in local DB to setup local SSH
959+ service although the local DB will be dropped soon. *)
960+ Db.Host. set_ssh_enabled ~__context ~self: host_ref ~value: ssh_enabled ;
961+ Db.Host. set_ssh_enabled_timeout ~__context ~self: host_ref
962+ ~value: ssh_enabled_timeout ;
963+ Db.Host. set_console_idle_timeout ~__context ~self: host_ref
964+ ~value: console_idle_timeout ;
965+ ( match ssh_enabled with
966+ | true ->
967+ Xapi_host. enable_ssh ~__context ~self: host_ref
968+ | false ->
969+ Xapi_host. disable_ssh ~__context ~self: host_ref
970+ ) ;
971+ (* As ssh_expiry will be updated by host.enable_ssh and host.disable_ssh,
972+ there is a corner case when the joiner's SSH state will not match SSH
973+ service state in its new coordinator exactly: if the joiner joins when
974+ SSH service has been enabled in the new coordinator, while not timed
975+ out yet, the joiner will start SSH service with timeout
976+ host.ssh_enabled_timeout, which means SSH service in the joiner be
977+ disabled later than in the new coordinator. *)
978+ let ssh_expiry = Db.Host. get_ssh_expiry ~__context ~self: host_ref in
979+
946980 debug " Creating host object on master" ;
947981 let ref =
948982 Client.Host. create ~rpc ~session_id ~uuid: my_uuid
@@ -962,7 +996,8 @@ let rec create_or_get_host_on_master __context rpc session_id (host_ref, host) :
962996 ~local_cache_sr ~chipset_info: host.API. host_chipset_info
963997 ~ssl_legacy: false
964998 ~last_software_update: host.API. host_last_software_update
965- ~last_update_hash: host.API. host_last_update_hash
999+ ~last_update_hash: host.API. host_last_update_hash ~ssh_enabled
1000+ ~ssh_enabled_timeout ~ssh_expiry ~console_idle_timeout
9661001 in
9671002 (* Copy other-config into newly created host record: *)
9681003 no_exn
0 commit comments