-
Notifications
You must be signed in to change notification settings - Fork 292
CP-53711: Copy SSH settings from pool coordinator in pool join #6395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,13 +170,16 @@ let make_host ~__context ?(uuid = make_uuid ()) ?(name_label = "host") | |
?(external_auth_service_name = "") ?(external_auth_configuration = []) | ||
?(license_params = []) ?(edition = "free") ?(license_server = []) | ||
?(local_cache_sr = Ref.null) ?(chipset_info = []) ?(ssl_legacy = false) | ||
?(last_software_update = Date.epoch) ?(last_update_hash = "") () = | ||
?(last_software_update = Date.epoch) ?(last_update_hash = "") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we add these parameters to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are used below: in line 181 and 182. |
||
?(ssh_enabled = true) ?(ssh_enabled_timeout = 0L) ?(ssh_expiry = Date.epoch) | ||
?(console_idle_timeout = 0L) () = | ||
let host = | ||
Xapi_host.create ~__context ~uuid ~name_label ~name_description ~hostname | ||
~address ~external_auth_type ~external_auth_service_name | ||
~external_auth_configuration ~license_params ~edition ~license_server | ||
~local_cache_sr ~chipset_info ~ssl_legacy ~last_software_update | ||
~last_update_hash | ||
~last_update_hash ~ssh_enabled ~ssh_enabled_timeout ~ssh_expiry | ||
~console_idle_timeout | ||
in | ||
Db.Host.set_cpu_info ~__context ~self:host ~value:default_cpu_info ; | ||
host | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -943,6 +943,38 @@ let rec create_or_get_host_on_master __context rpc session_id (host_ref, host) : | |
create_or_get_sr_on_master __context rpc session_id | ||
(my_local_cache_sr, my_local_cache_sr_rec) | ||
in | ||
let remote_coordinator = get_master ~rpc ~session_id in | ||
let ssh_enabled = | ||
Client.Host.get_ssh_enabled ~rpc ~session_id ~self:remote_coordinator | ||
in | ||
let ssh_enabled_timeout = | ||
Client.Host.get_ssh_enabled_timeout ~rpc ~session_id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can't do that without querying all the records. Or how? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That will query all the records of the host, I think it is expensive. |
||
~self:remote_coordinator | ||
in | ||
let console_idle_timeout = | ||
Client.Host.get_console_idle_timeout ~rpc ~session_id | ||
~self:remote_coordinator | ||
in | ||
(* Configure SSH service on local host *) | ||
Xapi_host.set_console_idle_timeout ~__context ~self:host_ref | ||
~value:console_idle_timeout ; | ||
Xapi_host.set_ssh_enabled_timeout ~__context ~self:host_ref | ||
~value:ssh_enabled_timeout ; | ||
( match ssh_enabled with | ||
| true -> | ||
Xapi_host.enable_ssh ~__context ~self:host_ref | ||
| false -> | ||
Xapi_host.disable_ssh ~__context ~self:host_ref | ||
) ; | ||
Comment on lines
+963
to
+968
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't really belong here in this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From L958 actually. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
(* As ssh_expiry will be updated by host.enable_ssh and host.disable_ssh, | ||
there is a corner case when the joiner's SSH state will not match SSH | ||
service state in its new coordinator exactly: if the joiner joins when | ||
SSH service has been enabled in the new coordinator, while not timed | ||
out yet, the joiner will start SSH service with timeout | ||
host.ssh_enabled_timeout, which means SSH service in the joiner will | ||
be disabled later than in the new coordinator. *) | ||
let ssh_expiry = Db.Host.get_ssh_expiry ~__context ~self:host_ref in | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The joining host is going through a reboot. What is the general policy for SSH over a reboot? If SSH was enabled before reboot, what is the state after reboot? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The joining host will not reboot, only xapi will have a restart to finish the joining.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the current policy is to sync the same status, including There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No, |
||
|
||
debug "Creating host object on master" ; | ||
let ref = | ||
Client.Host.create ~rpc ~session_id ~uuid:my_uuid | ||
|
@@ -962,7 +994,8 @@ let rec create_or_get_host_on_master __context rpc session_id (host_ref, host) : | |
~local_cache_sr ~chipset_info:host.API.host_chipset_info | ||
~ssl_legacy:false | ||
~last_software_update:host.API.host_last_software_update | ||
~last_update_hash:host.API.host_last_update_hash | ||
~last_update_hash:host.API.host_last_update_hash ~ssh_enabled | ||
~ssh_enabled_timeout ~ssh_expiry ~console_idle_timeout | ||
in | ||
(* Copy other-config into newly created host record: *) | ||
no_exn | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update these release versions when the feature branch is ready to be merged into the master branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fixup for merged code, not from the feature branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's easy to ignore changing the next to release version. Please remember do it when merging to master. BTW, there is gen_lifecycle to check datamodel_lifecycle.ml, see here. I think similar methods can be used for datamodel_pool and datamodel_host too. It can be considered in the future.