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

ctdb: nodes list command, wait for ctdb option #128

Merged

Conversation

phlogistonjohn
Copy link
Collaborator

@phlogistonjohn phlogistonjohn commented Jul 18, 2024

Add a samba-container ctdb-list-nodes command that emits a "nodes file" content to the stdout of the process.
Add hooks to set up a ctdb "nodes_cmd" config file option that tells ctdb to execute a command to fetch the nodes rather than read a file.

Also add a --wait-for=ctdb option to avoid starting certain services before ctdb is available and causing unnecessary container restarts.

Add the ability to write to an already open file to
cluster_meta_to_nodes. This will allow the function to be reused later
to emit the nodes list to the stdout.

Signed-off-by: John Mulligan <[email protected]>
Add a very simple ctdb-list-nodes subcommand that just takes the cluster
meta information and then outputs the desired "nodes list"/"nodes file"
content on the standard output.

Signed-off-by: John Mulligan <[email protected]>
sambacc/ctdb.py Outdated Show resolved Hide resolved
Add a `--wait-for=ctdb` option to the `samba-container run` subcommand.
This option will make sambacc wait for the condition, ctdb available
and returning a valid pnn, to be true before starting the server.

Signed-off-by: John Mulligan <[email protected]>
@phlogistonjohn phlogistonjohn changed the title [DNM] ctdb: nodes list command ctdb: nodes list command, wait for ctdb option Aug 6, 2024
@phlogistonjohn phlogistonjohn marked this pull request as ready for review August 6, 2024 18:36
Copy link
Collaborator

@synarete synarete left a comment

Choose a reason for hiding this comment

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

Looks fine. Few minor comments.

sambacc/ctdb.py Show resolved Hide resolved
@@ -704,6 +704,42 @@ def check_nodestatus(cmd: samba_cmds.SambaCommand = samba_cmds.ctdb) -> None:
samba_cmds.execute(cmd_ctdb_check)


def _read_command_pnn(cmd: samba_cmds.SambaCommand) -> typing.Optional[int]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not a big fan of this mixed int-or-None return value. I would prefer a more explicit typing; something like tuple[int, bool]. But I guess its just a matter of style.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, sorry but I find your suggestion less idiomatic. Hope you don't mind.

sambacc/commands/run.py Outdated Show resolved Hide resolved
Put a time bounds on the code that waits for the conditions using
a context manager that wraps alarm.

Signed-off-by: John Mulligan <[email protected]>
Copy link
Collaborator

@synarete synarete left a comment

Choose a reason for hiding this comment

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

lgtm

sambacc/ctdb.py Show resolved Hide resolved
@mergify mergify bot merged commit 406afac into samba-in-kubernetes:master Aug 8, 2024
9 checks passed
@phlogistonjohn phlogistonjohn deleted the jjm-cmd-nodes-list branch August 15, 2024 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants