This is gated behind a new option in `podman system migrate`,
`--migrate-db`, or by a system restart being performed.
BoltDB support was removed in Podman 6, so we are certain that,
when we start Podman, a SQLite state is in use. However, if we
also detect a valid BoltDB state, we will attempt a migration.
Migration is performed by retrieving all volumes, pods, and
containers (in that order, to ensure there are no dependency
conflicts) from the Bolt database, when adding them to the SQLite
database. If there is a conflict - IE, a container exists in both
SQLite and Bolt - we skip migration for that object. The old DB
is then renamed so we do not try to migrate it again.
Our ability to test complex migration scenarios is limited, but
this should handle simple migrations easily.
This is a heavily adapted version of #27660 rebuilt to work with
Podman 6.0. Substantial changes were required to throw errors
when a BoltDB database is detected and no migration is being
performed. Firstly, for automatic on-reboot migrations, we need
to have a deferred error returned by getDBState (very early in
runtime initialization) that is only acted on much later (once we
know for certain a state refresh is/is not being performed).
The `system migrate --migrate-db` command was much more
problematic. Conceptually, it's not terrible - add a flag to the
runtime to suppress errors, set that flag only when calling the
`system migrate` command with `--migrate-db` - but it unveiled a
serious problem with how we do runtime init (special flags to the
runtime were being ignored because the image runtime set the
Libpod runtime first and had none of the proper handling) which
took a genuinely annoying amount of time to identify and fix.
This cannot be tested automatically, as the ability to create Bolt
databases has been entirely removed with Podman 6.
This also includes 9b810aed3a from
the v5.8 branch by Luap99, which I have had to squash into this
commit to satisfy the build-each-commit check. It was just a
simplification of the SQLite path check.
Signed-off-by: Matt Heon <matthew.heon@pm.me>
Podman defaults to the directory of the Containerfile when no context dir is explicitly provided.
When running podman build with process subsituiton, `podman build -f <(echo "FROM scratch")`,
the Containerfile path expands to `/dev/fd/<NUM>`, which makes `/dev/fd` the context dir.
When building, Buildah attempts to create an overlay mount on top of the `/dev/fd` context dir, which fails.
In these cases, use a temp context dir instead: `$TMPDIR/podman-build-context-$randnum`
Fixes: https://github.com/containers/podman/issues/28113
Signed-off-by: Ashley Cui <acui@redhat.com>
Update build.sh to run gofumpt on generated .pb.go files, and apply
formatting to existing generated files. This fixes gofumpt and inamedparam
lint errors on macOS CI and ensures future regenerations will be
automatically formatted.
Signed-off-by: Lokesh Mandvekar <lsm5@linux.com>
The config.go file has a build tag that was never used. Also remove
unused functions from other files.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
If we're going to maintain migration capability for the full
lifespan of 6 - and I think we're going to have to - the only
sane options are a separate binary that exclusively performs
migrations, or re-adding BoltDB code - in a very minimal way - to
allow us to perform migrations within the standard 6 binary.
After attempting the separate binary approach, results are not
promising - it's impossible to strip enough out to make a truly
small binary that still does what we need to perform a migration.
That leaves re-adding BoltDB code.
This adds a minimal version of the BoltDB code that no longer
claims to be a valid State (freeing us from the requirement of
continued maintenance - we should never touch these bits again
until they get removed in 7) which has just enough to get every
container, pod, and volume in the DB, so we can migrate them to
SQLite.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Avoid reading /proc/filesystems on every container creation when
running as a service by caching the result.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
The syntax used here was wrong, see all the other existing pages.
Like this the man page gets rendered as "podman-container.unit(5)()" and
the HTML web page title will just be "NAME — Podman documentation"
instead of the proper man page name.
Fix this by using the right syntax.
Fixes: 7612af4c0e ("Rewrite the Quadlet documentation")
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
The Quadlet documentation rewrite added a render() pass that handles
`<<if VAR>>...<<endif>>` and `<<X if cond else Y>>` conditionals before
the existing `<<a|b>>` substitution and `<<subcommand>>` replacement run.
Tokens that didn't match the new conditional grammar were silently
consumed instead of passed through, so any `<<a|b>>` whose content
didn't fit the conditional shape disappeared from the rendered output.
The user-visible regression (containers/podman#28645) was the line in
options/sysctl.md:
Note: <<if using the **--ipc=host** option|...>>, the above sysctls
are not allowed.
Both halves of the substitution start with "if", so the inner string
matched `inner.startswith("if ")`, but the rest of the conditional
recogniser fell through and the whole token was dropped. The same
codepath also dropped `<<subcommand>>` tokens, which insert_file()
expects to replace later.
Fix: when none of the conditional/inline-if branches match, append the
original `<<...>>` token verbatim so downstream replace_type and
`<<subcommand>>` replacement can handle it. Add render() tests covering
the conditional grammar plus the regression case.
Verified by rendering all 307 files under docs/source/markdown/options/
in both is_quadlet=True and is_quadlet=False contexts; no failures.
Closes#28645
Signed-off-by: Matt Van Horn <mvanhorn@gmail.com>
This commit does the following:
- Splits the podman-systemd.unit.5.md into multiple files - one for each quadlet file type.
- Adds the podman-quadlet-basic-usage.7.md for quadlet examples.
- Majority of the text in the new files is copied from the podman-systemd.unit.5.md
- Adds support for very simple condditional in the markdown_preprocess.
- Uses new logic in markdown_preprocess in options/*.md to use a single .md file for both
podman subcommands man-pages and quadlet man-pages. This deduplicates the Quadlet man-pages a lot.
- Adds new `@@option quadlet:source.md`` preprocess command to import such .md files from options directory.
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
Replace the generic introductory paragraph with a detailed Persona
section that gives AI coding assistants explicit guidance on audience
assumptions, product mental model, upstream scope boundaries, quality
bar, and community expectations when helping Podman contributors.
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Assisted-by: Cursor:claude-opus-4-6