spiegel_podman/cmd/podman/system
Matt Heon 023a354de7 Remove Libpod special-init conditions
Before this, for some special Podman commands (system reset,
system migrate, system renumber), Podman would create a first
Libpod runtime to do initialization and flag parsing, then stop
that runtime and create an entirely new runtime to perform the
actual task. This is an artifact of the pre-Podman 2.0 days, when
there was almost no indirection between Libpod and the CLI, and
we only used one runtime because we didn't need a second runtime
for flag parsing and basic init.

This system was clunky, and apparently, very buggy. When we
migrated to SQLite, some logic was introduced where we'd select a
different database location based on whether or not Libpod's
StaticDir was manually set - which differed between the first
invocation of Libpod and the second. So we'd get a different
database for some commands (like `system reset`) and they would
not be able to see existing containers, meaning they would not
function properly.

The immediate cause is obviously the SQLite behavior, but I'm
certain there's a lot more baggage hiding behind this multiple
Libpod runtime logic, so let's just refactor it out. It doesn't
make sense, and complicates the code. Instead, make Reset,
Renumber, and Migrate methods of the libpod Runtime. For Reset
and Renumber, we can shut the runtime down afterwards to achieve
the desired effect (no valid runtime after). Then pipe all of
them through the ContainerEngine so cmd/podman can access them.

As part of this, remove the SystemEngine part of pkg/domain. This
was supposed to encompass these "special" commands, but every
command in SystemEngine is actually a ContainerEngine command.
Reset, Renumber, Migrate - they all need a full Libpod and access
to all containers. There's no point to a separate engine if it
just wraps Libpod in the exact same way as ContainerEngine. This
consolidation saves us a bit more code and complexity.

Signed-off-by: Matt Heon <mheon@redhat.com>

<MH: Fixed cherry-pick conflicts for v4.8 branch>

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-01-15 12:14:17 -05:00
..
connection Remove redundant nil checks in system connection remove 2023-09-03 15:42:41 +08:00
connection.go Add podman machine events 2022-05-03 13:49:01 -07:00
context.go Add support for podman context as alias to podman system connection 2022-09-15 08:17:15 -04:00
df.go system df: improve json output code 2023-01-03 18:12:06 +01:00
dial_stdio.go Fix stutters 2022-09-10 07:52:00 -04:00
events.go podman events: unhide --stream 2023-03-14 11:26:50 +01:00
info.go chore: replace github.com/ghodss/yaml with sigs.k8s.io/yaml 2023-04-06 21:11:17 +08:00
locks.go Address review feedback and add manpage notes 2023-06-06 11:04:59 -04:00
migrate.go Remove Libpod special-init conditions 2024-01-15 12:14:17 -05:00
prune.go Add podman system prune --external 2022-12-05 18:09:21 +01:00
renumber.go Remove Libpod special-init conditions 2024-01-15 12:14:17 -05:00
reset.go Remove Libpod special-init conditions 2024-01-15 12:14:17 -05:00
reset_machine.go Plumbing to run machine tests with hyperv 2023-09-14 15:57:35 -05:00
reset_machine_unsupported.go podman system reset removed machines incorrectly 2022-05-04 10:31:42 -04:00
service.go Use url with scheme and path for the unix address 2023-09-11 07:55:12 +02:00
service_abi.go Use url with scheme and path for the unix address 2023-09-11 07:55:12 +02:00
service_abi_common.go cmd/podman/system: add API server support on FreeBSD 2023-06-29 13:10:44 +01:00
service_abi_linux.go cmd/podman/system: add API server support on FreeBSD 2023-06-29 13:10:44 +01:00
system.go bump go module to version 4 2022-01-18 12:47:07 +01:00
unshare.go cmd/podman: switch to golang native error wrapping 2022-06-30 12:58:57 +02:00
version.go cmd: do not require userns for "version" 2023-03-03 14:27:54 +01:00