spiegel_podman/pkg/machine
Ashley Cui 17dbce2fb0 Clean up cached machine images
When initing machines, we download a machine image, and uncompress and
copy the image for the actual vm image. When a user constantly pulls new
machines, there may be a buildup of old, unused machine images. This
commit cleans ups the unused cached images.

Changes:
- If the machine is pulled from a URL or from the FCOS releases, we pull
  them into XDG_DATA_HOME/containers/podman/machine/vmType/cache
- Cache cleanups only happen if there is a cache miss, and we need to
  pull a new image
- For Fedora and FCOS, we actually use the cache, so we go through the
  cache dir and remove any images older than 2 weeks (FCOS's release cycle), on a cache miss.
- For generic files pulled from a URL, we don't actually cache, so we
  delete the pulled file immediately after creating a machine image
- For generic files from a local path, the original file will never be
  cleaned up

Note that because we cache in a different dir, this will not clean up
old images pulled before this commit.

[NO NEW TESTS NEEDED]

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-07-26 13:32:33 -04:00
..
e2e Fix last machine test 2022-07-26 13:08:37 -04:00
qemu podman machine: do not commit proxies into config file 2022-07-26 13:02:39 -04:00
wsl Fixes #14698 Use prepared image for WSL2 machine init 2022-07-26 13:19:48 -04:00
config.go Clean up cached machine images 2022-07-26 13:32:33 -04:00
config_test.go pkg/machine: add missing build tags to tests 2022-07-04 18:09:30 +02:00
connection.go pkg: switch to golang native error wrapping 2022-07-08 08:54:47 +02:00
fcos.go Clean up cached machine images 2022-07-26 13:32:33 -04:00
fedora.go Clean up cached machine images 2022-07-26 13:32:33 -04:00
ignition.go Fix spelling "setup" -> "set up" and similar 2022-06-22 18:39:21 +02:00
ignition_darwin.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
ignition_linux.go Set machine timezone 2021-12-16 12:40:20 -06:00
ignition_schema.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
ignition_windows.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
keys.go Machine init: create .ssh dir if not exist 2022-07-26 13:29:40 -04:00
machine_unsupported.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
pull.go Clean up cached machine images 2022-07-26 13:32:33 -04:00