@@ -943,38 +943,6 @@ 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 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-
978946 debug " Creating host object on master" ;
979947 let ref =
980948 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) :
994962 ~local_cache_sr ~chipset_info: host.API. host_chipset_info
995963 ~ssl_legacy: false
996964 ~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
999970 in
1000971 (* Copy other-config into newly created host record: *)
1001972 no_exn
@@ -1588,6 +1559,7 @@ let join_common ~__context ~master_address ~master_username ~master_password
15881559 )
15891560 in
15901561
1562+ let remote_coordinator = get_master ~rpc ~session_id in
15911563 (* If management is on a VLAN, then get the Pool master
15921564 management network bridge before we logout the session *)
15931565 let pool_master_bridge, mgmt_pif =
@@ -1598,7 +1570,7 @@ let join_common ~__context ~master_address ~master_username ~master_password
15981570 if Db.PIF. get_VLAN_master_of ~__context ~self: my_pif <> Ref. null then
15991571 let pif =
16001572 Client.Host. get_management_interface ~rpc ~session_id
1601- ~host: (get_master ~rpc ~session_id )
1573+ ~host: remote_coordinator
16021574 in
16031575 let network = Client.PIF. get_network ~rpc ~session_id ~self: pif in
16041576 (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
16881660 " Unable to set the write the new pool certificates to the disk : %s"
16891661 (ExnHelper. string_of_exn e)
16901662 ) ;
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+ ) ;
16911696 (* this is where we try and sync up as much state as we can
16921697 with the master. This is "best effort" rather than
16931698 critical; if we fail part way through this then we carry
0 commit comments