-
Notifications
You must be signed in to change notification settings - Fork 331
Description
I finally got around to changing our updater to use staged deployments and one thing we lose is pruning of the rollback deployment. Since the ref isn't removed until the new deployment is finalized, the objects are still on disk until some later process prunes. Our updater runs a full cleanup after staging, so the old rollback deployment would get pruned when a new update comes in. However, that may not happen for a long time and it effectively means that you always have 3 deployments on disk.
We could solve this downstream in Endless, but fixing this is something that any user of ostree staged deployments could benefit from. My idea is to have a sysroot autocleanup mode that only runs the cleanup if a known file exists and then delete it when the cleanup completes.
For example, /sysroot/.cleanup
is written out when the deployment is finalized. Add an API (or a cmdprivate) that runs ostree_sysroot_cleanup
only when /sysroot/.cleanup
exists and deletes it when done. Call this from ostree admin cleanup --auto
. Add a systemd unit like ostree-sysroot-auto-cleanup.service
with ConditionPathExists=/sysroot/.cleanup
and ExecStart=/usr/bin/ostree admin cleanup --auto
.
WDYT?