-
Notifications
You must be signed in to change notification settings - Fork 291
CP-53721 Enable XAPI to configure SSH auto mode #6442
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
base: feature/configure-ssh-phase3
Are you sure you want to change the base?
CP-53721 Enable XAPI to configure SSH auto mode #6442
Conversation
8a0098f
to
ffe74a1
Compare
ocaml/xapi/xapi_host.ml
Outdated
value ; | ||
|
||
if value && Db.Host.get_ssh_enabled ~__context ~self then | ||
raise (Api_errors.Server_error (Api_errors.ssh_auto_mode_conflict, [])) ; |
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.
When a user manually enables SSH using host.enable_ssh
, we assume they expect SSH to remain enabled continuously. Therefore, we must set auto-mode to false; otherwise, auto-mode would automatically disable the SSH that the user just explicitly enabled.
ffe74a1
to
c196dc5
Compare
I marked this as Draft while we are still reviewing the design. |
Add new host object fields: - ssh_auto_mode Add new host/pool API to enable to set auto mode - set_ssh_auto_mode Signed-off-by: Lunfan Zhang <[email protected]>
c196dc5
to
e139fbe
Compare
e139fbe
to
48cfe77
Compare
Update base branch to feature/configure-ssh-phase3 (NOTE: Default auto mode setting for XS8/XS9, pool join/eject operations will not include in this PR) |
Implemented XAPI APIs for SSH auto mode configuration: - `host.set_ssh_auto_mode`: Configures SSH auto mode for a specific host. - `pool.set_ssh_auto_mode`: Configures SSH auto mode for all hosts in the pool. Additionally: - `host.enable_ssh` now automatically sets SSH auto mode to `false`. Signed-off-by: Lunfan Zhang <[email protected]>
Updated `records.ml` file to support `host-param-set/get/list` and `pool-param-set/get/list` for ssh-auto-mode. Signed-off-by: Lunfan Zhang <[email protected]>
48cfe77
to
9624328
Compare
Hi @robhoes Since we have completed some offline reviews locally, if you have no further comments, this PR will be merged. |
|
||
let set_ssh_auto_mode ~__context ~self ~value = | ||
info "Pool.set_ssh_auto_mode: pool='%s' value='%b'" | ||
(pool_uuid ~__context self) |
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 believe we report at the API level the reference (rather the UUID) in logs. User-facing messages report the UUID, though.
let disable_ssh_internal ~__context ~self = | ||
try | ||
debug "Disabling SSH for host %s" (Helpers.get_localhost_uuid ()) ; | ||
Xapi_systemctl.disable ~wait_until_success:false !Xapi_globs.ssh_service ; | ||
if Db.Host.get_ssh_auto_mode ~__context ~self = false then |
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.
Could use if not (Db.Host.get_ssh_auto_mode .. )
This PR introduces support for Dom0 SSH control, providing the capability to configure the auto mode for a specific host or all hosts in the pool.
New Host Object Fields and Host/Pool API:
ssh_auto_mode
: Indicates whether SSH auto mode is enabled. configure to true means startup SSH when the XAPI service is down; stop SSH when the XAPI service is up. configure to false means SSH service status is independent and not effected by the XAPI service status.set_ssh_auto_mode
: Allows setting auto mode for specific host or all hosts in the pool.(Note: Default value for XS8/XS9, pool join/eject operations, and XAPI startup scenarios will be addressed in the next PR, this PR only include the change of data_mode/API/cli )