Repository navigation
Conversation
`container delete` and `container prune` returned success when the bundle directory could not be removed, because `ContainersService._cleanUp` logged the failure and then dropped the container from state unconditionally. The caller had no way to know the data was still on disk. Capture the bundle deletion error, keep removing the container from state, and rethrow so `delete` and `prune` surface it. `prune` now counts reclaimed space only for containers it actually removed, aggregates failures, and exits non-zero.
This branch has not been deployed
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.
Closes #2573.
Type of Change
Motivation and Context
container deleteandcontainer prunereported success even when the container bundle could not be removed from disk.ContainersService._cleanUptreated bundle deletion as best effort: it logged a warning and then removed the container from the in-memory state unconditionally, so the API returned success. The CLI then printed the container ID and reported reclaimed disk space while the data was still on disk and no longer reachable through any container command.Reproduced by making the bundle read-only:
The bundle directory was still present afterwards and
container ls -ano longer listed the container, leaving the directory only removable by hand.What changed
ContainersService._cleanUpcaptures a bundle deletion failure and throwsContainerizationError(.internalError, message: "failed to delete bundle for container <id> at <path>: <cause>")after removing the container from the state map. The container is not usable either way, but the caller learns that data remains and the message names the path.ContainerPrunecounts disk usage only after a successful delete, accumulates failures, and ends withfailed to prune one or more containers: [...]and a non-zero exit. "Reclaimed" is only logged when at least one container was pruned.testDeleteReportsBundleCleanupFailuretoTestCLIPruneCommandSerial: it creates a container, clears the write bits on its bundle directory, and asserts thatcontainer deleteexits non-zero and names the bundle in the error. The bundle path is resolved fromcontainer system status --format json(paths.appRoot), so the test does not depend on runner environment variables.Behavior change
deletepreviously never failed due to cleanup problems. It now fails when the bundle cannot be removed, while the container still leaves the state store. I chose this over keeping the record (which would make a logically deleted container keep showing up incontainer ls -a); happy to switch if the best-effort semantics were intentional.Testing
Manual verification with a debug build of this branch:
Before (
main):After:
Normal prune (no permission failure) still prints the removed containers and reclaims space as before, and
container deleteon a normal container is unchanged.The new integration test fails against an apiserver built from
main(result.status != 0) and passes with this branch.