Add osism get mariadb-backup-host - #2729
Merged
Merged
Conversation
ideaship
force-pushed
the
mariadb-backup-host
branch
from
September 27, 2026 16:52
e8458fe to
66d17a8
Compare
"osism apply mariadb-backup" writes its archives to one MariaDB host, and nothing in osism can say which one before a backup is taken. The mariadb role resolves it from a role default over a shard group built during the play, and the usual override is an extra var from environments/kolla/configuration.yml. None of that is in the inventory, so "osism get hostvars" reports the variable as not found, and "osism get hosts" sorts alphabetically and cannot show the inventory order the default depends on. Operators are left to probe each MariaDB host for /etc/kolla/mariabackup. Add "osism get mariadb-backup-host". It runs the read-only kolla-mariadb-backup-host.yml play on the kolla-ansible worker, which asks the mariadb role itself. The play evaluates the backup task's own condition on every MariaDB host, across all shards, and reports once: mariadb_backup_host=<host> resolved=<host per shard> The first field is the host the backup runs on, empty if there is none; the second lists what each shard resolved. The command dispatches the play with kolla.run and publish=False and takes the play output from the task result instead of streaming it, so only the answer is printed. A table is printed by default; --format script prints the bare host name, for use in shell commands. The command exits non-zero if the play reports no backup host, naming the resolved candidates: kolla backs up only the default shard and would skip the backup without a word, for example when mariadb_backup_host is overridden to a host outside it. It also exits non-zero if the play reports nothing, if the play fails, and on timeout. Since the play output is not streamed, the error for a failed play points at "osism apply -e kolla mariadb-backup-host" for the full output. On timeout the pending result is forgotten explicitly; left to interpreter shutdown, Celery prints a traceback. This depends on kolla-mariadb-backup-host.yml in osism/container-image-kolla-ansible, which has to be merged first. Tested on a 2026.1 cluster with the playbook placed in the kolla-ansible container: the command printed the host holding /etc/kolla/mariabackup in both formats; with a failing play (the playbook removed) and with a 1 s timeout it exited 1 with the respective error. The sharded and no-backup-host reports were verified at the play level, with a second shard simulated through an extra inventory source. DocImpact Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Roger Luethi <luethi@osism.tech>
ideaship
force-pushed
the
mariadb-backup-host
branch
from
September 27, 2026 16:58
66d17a8 to
ad76e97
Compare
ideaship
marked this pull request as ready for review
September 28, 2026 07:17
berendt
pushed a commit
to osism/osism.github.io
that referenced
this pull request
Sep 28, 2026
"osism get mariadb-backup-host" reports the host that "osism apply mariadb-backup" writes its archives to. Until now an operator could not look this up: the value is a kolla-ansible role default over a shard group built during the play, and the usual override is an extra var, none of which "osism get hostvars" or "osism get hosts" can see. Add it to the CLI reference next to the other get commands: the default table output, --format script for use in scripts, and --timeout. Say that the host is resolved by the mariadb role itself, so overrides of mariadb_backup_host count, and that the command runs a read-only play on the kolla-ansible worker and therefore takes a few seconds. Explain that with several MariaDB shards the command reports the default shard's host, the only one kolla-ansible backs up. Document the non-zero exits an operator will meet: no host that would be backed up, for example with mariadb_backup_host set to a host outside the default shard, where kolla-ansible skips the backup without an error; and a failed play, whose full output "osism apply -e kolla mariadb-backup-host" shows. The command comes from osism/python-osism#2729, which needs the playbook from osism/container-image-kolla-ansible#965. This should merge only after both. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Roger Luethi <luethi@osism.tech>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
osism apply mariadb-backupwrites its archives to one MariaDB host, and nothing in osism can say which one before a backup is taken. This addsosism get mariadb-backup-host.Depends on:
That PR adds the playbook this command runs, so it has to be merged first.
Documentation:
Why the host cannot be looked up today
The mariadb role resolves it from a role default over a shard group built during the play, and the usual override is an extra var from
environments/kolla/configuration.yml. None of that is in the inventory:osism get hostvars <host> mariadb_backup_hostreports the variable as not found;osism get hosts -l mariadbsorts alphabetically, so it cannot show the inventory order the default depends on.Operators are left to probe each MariaDB host for
/etc/kolla/mariabackup.What the command does
It runs the read-only
kolla-mariadb-backup-host.ymlplay on the kolla-ansible worker. The play asks the mariadb role itself: it evaluates the backup task's own condition on every MariaDB host, across all shards, and reports once:The first field is the host the backup runs on, empty if there is none; the second lists what each shard resolved.
The command dispatches it with
kolla.runandpublish=False, takes the output from the task result instead of streaming it, and prints only the answer:--format script, the bare host name for use in shell commands.It exits non-zero:
mariadb_backup_hostis overridden to a host outside it;osism apply -e kolla mariadb-backup-hostfor the full output;Why a play and not a local lookup
resolve_in_host_contextevaluates expressions in a host's inventory context, but sees neither the role default nor the extra vars. Using it would mean copying kolla's rule into python-osism. The play leaves the resolution to the role, asosism validatealready does for its kolla-ansible validators.Testing
tests/unit/commands/test_get.py.kolla-ansiblecontainer and thisget.pyloaded inosismclient:/etc/kolla/mariabackup;--timeout 1, it exited 1 with the timeout error and no traceback.🤖 Generated with Claude Code