@@ -943,38 +943,6 @@ 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
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 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
- (* As ssh_expiry will be updated by host.enable_ssh and host.disable_ssh,
970
- there is a corner case when the joiner's SSH state will not match SSH
971
- service state in its new coordinator exactly: if the joiner joins when
972
- SSH service has been enabled in the new coordinator, while not timed
973
- out yet, the joiner will start SSH service with timeout
974
- host.ssh_enabled_timeout, which means SSH service in the joiner will
975
- be disabled later than in the new coordinator. *)
976
- let ssh_expiry = Db.Host. get_ssh_expiry ~__context ~self: host_ref in
977
-
978
946
debug " Creating host object on master" ;
979
947
let ref =
980
948
Client.Host. create ~rpc ~session_id ~uuid: my_uuid
@@ -994,8 +962,11 @@ let rec create_or_get_host_on_master __context rpc session_id (host_ref, host) :
994
962
~local_cache_sr ~chipset_info: host.API. host_chipset_info
995
963
~ssl_legacy: false
996
964
~last_software_update: host.API. host_last_software_update
997
- ~last_update_hash: host.API. host_last_update_hash ~ssh_enabled
998
- ~ssh_enabled_timeout ~ssh_expiry ~console_idle_timeout
965
+ ~last_update_hash: host.API. host_last_update_hash
966
+ ~ssh_enabled: host.API. host_ssh_enabled
967
+ ~ssh_enabled_timeout: host.API. host_ssh_enabled_timeout
968
+ ~ssh_expiry: host.API. host_ssh_expiry
969
+ ~console_idle_timeout: host.API. host_console_idle_timeout
999
970
in
1000
971
(* Copy other-config into newly created host record: *)
1001
972
no_exn
@@ -1588,6 +1559,7 @@ let join_common ~__context ~master_address ~master_username ~master_password
1588
1559
)
1589
1560
in
1590
1561
1562
+ let remote_coordinator = get_master ~rpc ~session_id in
1591
1563
(* If management is on a VLAN, then get the Pool master
1592
1564
management network bridge before we logout the session *)
1593
1565
let pool_master_bridge, mgmt_pif =
@@ -1598,7 +1570,7 @@ let join_common ~__context ~master_address ~master_username ~master_password
1598
1570
if Db.PIF. get_VLAN_master_of ~__context ~self: my_pif <> Ref. null then
1599
1571
let pif =
1600
1572
Client.Host. get_management_interface ~rpc ~session_id
1601
- ~host: (get_master ~rpc ~session_id )
1573
+ ~host: remote_coordinator
1602
1574
in
1603
1575
let network = Client.PIF. get_network ~rpc ~session_id ~self: pif in
1604
1576
(Some (Client.Network. get_bridge ~rpc ~session_id ~self: network), my_pif)
@@ -1688,6 +1660,39 @@ let join_common ~__context ~master_address ~master_username ~master_password
1688
1660
" Unable to set the write the new pool certificates to the disk : %s"
1689
1661
(ExnHelper. string_of_exn e)
1690
1662
) ;
1663
+ ( try
1664
+ let ssh_enabled_timeout =
1665
+ Client.Host. get_ssh_enabled_timeout ~rpc ~session_id
1666
+ ~self: remote_coordinator
1667
+ in
1668
+ let console_idle_timeout =
1669
+ Client.Host. get_console_idle_timeout ~rpc ~session_id
1670
+ ~self: remote_coordinator
1671
+ in
1672
+ Xapi_host. set_console_idle_timeout ~__context ~self: me
1673
+ ~value: console_idle_timeout ;
1674
+ Xapi_host. set_ssh_enabled_timeout ~__context ~self: me
1675
+ ~value: ssh_enabled_timeout ;
1676
+ let ssh_enabled =
1677
+ Client.Host. get_ssh_enabled ~rpc ~session_id
1678
+ ~self: remote_coordinator
1679
+ in
1680
+ (* As ssh_expiry will be updated by host.enable_ssh and host.disable_ssh,
1681
+ there is a corner case when the joiner's SSH state will not match SSH
1682
+ service state in its new coordinator exactly: if the joiner joins when
1683
+ SSH service has been enabled in the new coordinator, while not timed
1684
+ out yet, the joiner will start SSH service with timeout
1685
+ host.ssh_enabled_timeout, which means SSH service in the joiner will
1686
+ be disabled later than in the new coordinator. *)
1687
+ match ssh_enabled with
1688
+ | true ->
1689
+ Xapi_host. enable_ssh ~__context ~self: me
1690
+ | false ->
1691
+ Xapi_host. disable_ssh ~__context ~self: me
1692
+ with e ->
1693
+ error " Unable to configure SSH service on local host: %s"
1694
+ (ExnHelper. string_of_exn e)
1695
+ ) ;
1691
1696
(* this is where we try and sync up as much state as we can
1692
1697
with the master. This is "best effort" rather than
1693
1698
critical; if we fail part way through this then we carry
0 commit comments