Skip to content
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

CP-52074: Add API for start/stop systemd service sshd #6198

Merged

Conversation

BengangY
Copy link
Contributor

@BengangY BengangY commented Dec 27, 2024

This PR is to add API and CLI which is used to enable and disable SSH on all hosts in a pool or on specified hosts within a pool.

~params:
[
(Ref _host, "self", "The host")
; (ssh_status, "status", "Status of sshd service")
Copy link
Member

@psafont psafont Dec 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend to have 2 calls, one to turn it on, and one to turn it off. This is because enums tend to be problematic for upgrades, so I'd rather avoid them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given we are later going to have an auto mode, I would like to use a single API with different parameters (e.g. on, off, auto, etc). Then we only need to add 1 API instead of adding 3 APIs.

Copy link
Member

@psafont psafont Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given we are later going to have an auto mode

This doesn't look like it's a small one off, but something that needs its design reviewed.
Please add the design to xapi's documentation so we can take an honest look at this code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this all looks reasonable. I don't think a detailed design would be required but some motivation and rationale would be good to have. If we already know that we want additional enums, it might be good to provide them on the API level already but to return an error like "not supported" for them. This would make update cases in the future simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed the design today, we decided to move the 'auto' mode to another API. So the new added API only contains starting and stopping ssh. So I splitted the API to start_ssh and stop_ssh.

@BengangY BengangY force-pushed the private/bengangy/CP-52074 branch 2 times, most recently from 96270dd to 36a05a1 Compare January 2, 2025 10:14
@BengangY BengangY marked this pull request as ready for review January 2, 2025 10:27
@@ -61,6 +61,15 @@ let telemetry_frequency =
]
)

let ssh_status =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't need more than on/off a simpler call ...-enable taking a boolean would suffice. But if we do need more, an enum could be the right choice. We probably should define all planned values right away and avoid extending the enum later, if possible.

@BengangY BengangY force-pushed the private/bengangy/CP-52074 branch from 36a05a1 to 5b9f737 Compare January 8, 2025 14:03
@lindig
Copy link
Contributor

lindig commented Jan 8, 2025

Maybe it's not needed but there is no API to observe the status of the SSH service; to be sure, you have to enable it before using it,

@BengangY BengangY force-pushed the private/bengangy/CP-52074 branch from 5b9f737 to 27f8377 Compare January 9, 2025 03:00
ocaml/xapi/xapi_host.ml Outdated Show resolved Hide resolved
@BengangY BengangY force-pushed the private/bengangy/CP-52074 branch 2 times, most recently from 3d25716 to 77005e9 Compare January 9, 2025 07:43
ocaml/forkexecd/lib/fe_systemctl.ml Outdated Show resolved Hide resolved
ocaml/xapi-cli-server/cli_frontend.ml Outdated Show resolved Hide resolved
ocaml/xapi-cli-server/cli_frontend.ml Outdated Show resolved Hide resolved
ocaml/xapi/xapi_pool.ml Outdated Show resolved Hide resolved
ocaml/xapi-cli-server/cli_frontend.ml Outdated Show resolved Hide resolved
ocaml/idl/datamodel_host.ml Outdated Show resolved Hide resolved
ocaml/idl/datamodel_host.ml Outdated Show resolved Hide resolved
ocaml/xapi-cli-server/cli_frontend.ml Show resolved Hide resolved
ocaml/idl/datamodel_host.ml Outdated Show resolved Hide resolved
ocaml/idl/datamodel_pool.ml Outdated Show resolved Hide resolved
@BengangY BengangY force-pushed the private/bengangy/CP-52074 branch from 77005e9 to badbeaa Compare January 10, 2025 07:16
@BengangY BengangY force-pushed the private/bengangy/CP-52074 branch from badbeaa to 26cfbbe Compare January 13, 2025 01:31
ocaml/idl/datamodel_host.ml Outdated Show resolved Hide resolved
ocaml/idl/datamodel_host.ml Outdated Show resolved Hide resolved
ocaml/xapi/xapi_pool.ml Outdated Show resolved Hide resolved
@BengangY BengangY force-pushed the private/bengangy/CP-52074 branch from 26cfbbe to 30d21c9 Compare January 13, 2025 12:24
@BengangY BengangY force-pushed the private/bengangy/CP-52074 branch from 30d21c9 to 944a91d Compare January 14, 2025 05:31
@BengangY BengangY merged commit 90e9602 into xapi-project:feature/configure-ssh Jan 14, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants