-
Notifications
You must be signed in to change notification settings - Fork 389
container: T6673: Fix restart of containers with podman #4691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixed issue with podman and systemd sync when restarting containers with 'podman restart' command.
👍 |
- Placed podman storage directory in vyos/defaults.py - Replaced repeated declarations with vyos.defaults.directories['podman_storage']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix logic looks sensible to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where containers become unrecoverable when users incorrectly restart them using direct podman commands instead of VyOS commands. The fix adds logic to clean up stale overlay layers when container restart fails.
- Adds a
clean_layer()
function to remove corrupted container overlay layers - Updates the container restart operation to attempt layer cleanup on initial failure
- Adds the podman storage directory path to the VyOS defaults configuration
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/op_mode/container.py | Implements layer cleanup functionality and integrates it into the restart operation |
python/vyos/defaults.py | Adds podman storage directory path constant |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
CI integration 👍 passed! Details
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes addressed
Change summary
When a user incorrectly tries to restart a podman container with
podman container restart <container>
, the podman and quadlet config will go out of sync, and you will not be able to recover the container.Attempting to restart the container afterwards the correct way will result in a failure.
Deleting the config and trying to reapply it doesn't work:
Even restarting won't correct the issue. When looking at the logs, we can see that the issue is that the previous overlay layer directory still has data in it. And the quadlet wants to recreate the container, which fails due to the
directory not empty
error:This added function will clean the stale overlay layer so the container can be reinitialized correctly.
Types of changes
Related Task(s)
https://vyos.dev/T6673
Related PR(s)
How to test / Smoketest result
Create a container:
Restart the container with podman commands:
Attempt to restart the container using VyOS op-mode command:
Before:
After:
Verify container is present:
Checklist: