-
Notifications
You must be signed in to change notification settings - Fork 16
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
ctdb: nodes list command, wait for ctdb option #128
Conversation
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]>
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]>
Signed-off-by: John Mulligan <[email protected]>
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]>
2080471
to
7f0c171
Compare
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.
Looks fine. Few minor comments.
@@ -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]: |
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 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.
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.
Yeah, sorry but I find your suggestion less idiomatic. Hope you don't mind.
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]>
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.
lgtm
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.