Skip to content

fix(podman): remove only sandbox-owned managed volumes - #4714

Open
lunarwhite wants to merge 1 commit into
NVIDIA:mainfrom
lunarwhite:fix/4111-podman-owned-volumes/lunarwhite
Open

lunarwhite wants to merge 1 commit into
NVIDIA:mainfrom
lunarwhite:fix/4111-podman-owned-volumes/lunarwhite

Conversation

@lunarwhite

@lunarwhite lunarwhite commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Podman delete now removes a managed channel, control, or workspace volume only when an exact-name inspect shows its openshell.ai/sandbox-id label names the sandbox. This covers the gateway's failed-create cleanup too, which calls delete. It also closes a gap beyond the issue: Podman resolves a volume DELETE by unique name prefix when the exact name is missing, so deleting a custom-WORKDIR sandbox could remove a volume such as openshell-sandbox-<id>-workspace-bak.

Related Issue

Closes #4111

Changes

  • PodmanClient::remove_owned_volume deletes only on a matching sandbox-ID label; delete knows only the ID, so options and other labels are ignored. A missing volume is a no-op; any other volume is kept with a warning naming the reason, and delete still succeeds.
  • delete_sandbox uses it for all six volume removals, keeping their order and log levels.
  • Create rollback no longer touches the workspace volume name for custom-WORKDIR images, which never create it, mirroring the existing channel guard.
  • The control volume gets its own rollback guard instead of sharing the channel's, so rollback no longer removes a control volume that create refused.
  • The driver README notes that delete keeps and logs such volumes.

Known limits: unlabeled volumes from before #3538 (0.0.x, v0.1.0-pre.1 to pre.7) are now kept with a warning, and a volume replaced or removed between the inspect and the DELETE can still be removed, because Podman's volume DELETE takes no precondition. Docker's name-only removal is out of scope.

Testing

  • Checks appropriate to the affected code and behavior pass: mise run rust:format:check, cargo clippy -p openshell-driver-podman --all-targets -- -D warnings, cargo test -p openshell-driver-podman (253 passed), mise run markdown:lint
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

New stub tests, each failing on the previous code:

  • No workload (the failed-create path): an unlabeled channel volume and another sandbox's workspace volume get no DELETE.
  • Workload present: an unlabeled volume at a custom-WORKDIR sandbox's workspace name gets no DELETE, and the channel and control volumes are still removed.
  • A failed custom-WORKDIR create sends no request for the workspace volume name.

The two delete tests assert the full request log. Existing delete tests now script the inspects and cover owner options, empty options, a missing volume, and an absent workload. The Podman e2e lanes under test:e2e are pending CI (Podman isn't installed locally); they run the new inspect on every delete but don't check volume removal.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

@copy-pr-bot

copy-pr-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Signed-off-by: Yuedong Wu <dwcn22@outlook.com>
@lunarwhite
lunarwhite force-pushed the fix/4111-podman-owned-volumes/lunarwhite branch from ebdbc80 to 34d65f4 Compare October 24, 2026 12:29

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(podman): verify managed volume ownership before sandbox cleanup

1 participant