@@ -943,29 +943,13 @@ let rec create_or_get_host_on_master __context rpc session_id (host_ref, host) :
943
943
create_or_get_sr_on_master __context rpc session_id
944
944
(my_local_cache_sr, my_local_cache_sr_rec)
945
945
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
946
+ let ssh_enabled = Db.Host. get_ssh_enabled ~__context ~self: host_ref in
950
947
let ssh_enabled_timeout =
951
- Client.Host. get_ssh_enabled_timeout ~rpc ~session_id
952
- ~self: remote_coordinator
948
+ Db.Host. get_ssh_enabled_timeout ~__context ~self: host_ref
953
949
in
954
950
let console_idle_timeout =
955
- Client.Host. get_console_idle_timeout ~rpc ~session_id
956
- ~self: remote_coordinator
951
+ Db.Host. get_console_idle_timeout ~__context ~self: host_ref
957
952
in
958
- (* Configure SSH service on local host *)
959
- Xapi_host. set_console_idle_timeout ~__context ~self: host_ref
960
- ~value: console_idle_timeout ;
961
- Xapi_host. set_ssh_enabled_timeout ~__context ~self: host_ref
962
- ~value: ssh_enabled_timeout ;
963
- ( match ssh_enabled with
964
- | true ->
965
- Xapi_host. enable_ssh ~__context ~self: host_ref
966
- | false ->
967
- Xapi_host. disable_ssh ~__context ~self: host_ref
968
- ) ;
969
953
(* As ssh_expiry will be updated by host.enable_ssh and host.disable_ssh,
970
954
there is a corner case when the joiner's SSH state will not match SSH
971
955
service state in its new coordinator exactly: if the joiner joins when
@@ -1588,6 +1572,7 @@ let join_common ~__context ~master_address ~master_username ~master_password
1588
1572
)
1589
1573
in
1590
1574
1575
+ let remote_coordinator = get_master ~rpc ~session_id in
1591
1576
(* If management is on a VLAN, then get the Pool master
1592
1577
management network bridge before we logout the session *)
1593
1578
let pool_master_bridge, mgmt_pif =
@@ -1598,7 +1583,7 @@ let join_common ~__context ~master_address ~master_username ~master_password
1598
1583
if Db.PIF. get_VLAN_master_of ~__context ~self: my_pif <> Ref. null then
1599
1584
let pif =
1600
1585
Client.Host. get_management_interface ~rpc ~session_id
1601
- ~host: (get_master ~rpc ~session_id )
1586
+ ~host: remote_coordinator
1602
1587
in
1603
1588
let network = Client.PIF. get_network ~rpc ~session_id ~self: pif in
1604
1589
(Some (Client.Network. get_bridge ~rpc ~session_id ~self: network), my_pif)
@@ -1688,6 +1673,38 @@ let join_common ~__context ~master_address ~master_username ~master_password
1688
1673
" Unable to set the write the new pool certificates to the disk : %s"
1689
1674
(ExnHelper. string_of_exn e)
1690
1675
) ;
1676
+ ( try
1677
+ let ssh_enabled_timeout =
1678
+ Client.Host. get_ssh_enabled_timeout ~rpc ~session_id
1679
+ ~self: remote_coordinator
1680
+ in
1681
+ let console_idle_timeout =
1682
+ Client.Host. get_console_idle_timeout ~rpc ~session_id
1683
+ ~self: remote_coordinator
1684
+ in
1685
+ (* Configure SSH service on local host to apply the settings which
1686
+ will persisit after it joins the new pool.
1687
+ Please note that ssh_enabled_timeout needs be set before
1688
+ update_non_vm_metadata(), inside which ssh_expiry is queried to
1689
+ set to host obj in remote coordinator DB.
1690
+ *)
1691
+ Xapi_host. set_console_idle_timeout ~__context ~self: me
1692
+ ~value: console_idle_timeout ;
1693
+ Xapi_host. set_ssh_enabled_timeout ~__context ~self: me
1694
+ ~value: ssh_enabled_timeout ;
1695
+ let ssh_enabled =
1696
+ Client.Host. get_ssh_enabled ~rpc ~session_id
1697
+ ~self: remote_coordinator
1698
+ in
1699
+ match ssh_enabled with
1700
+ | true ->
1701
+ Xapi_host. enable_ssh ~__context ~self: me
1702
+ | false ->
1703
+ Xapi_host. disable_ssh ~__context ~self: me
1704
+ with e ->
1705
+ error " Unable to configure SSH service on local host: %s"
1706
+ (ExnHelper. string_of_exn e)
1707
+ ) ;
1691
1708
(* this is where we try and sync up as much state as we can
1692
1709
with the master. This is "best effort" rather than
1693
1710
critical; if we fail part way through this then we carry
0 commit comments