-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix unless-stopped restart policy to match Docker behavior
#27619
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
Fix unless-stopped restart policy to match Docker behavior
#27619
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Honny1 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
5b28844 to
33a8d52
Compare
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
|
I haven't looked at the code but I find Given this only targets the on boot start , maybe something more like |
33a8d52 to
b5b5d8f
Compare
That is a much better name. I have renamed it |
b5b5d8f to
22bc44c
Compare
libpod/container_api.go
Outdated
|
|
||
| // Indicate whether or not the container will should start after a reboot of system | ||
| func (c *Container) ShouldStartOnBoot() bool { | ||
| logrus.Debugf("Checking if container %s needs restart", c.ID()) |
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.
Probably should drop this, since it's part of a filter, we'll spam the debug logs
libpod/container_api.go
Outdated
| } | ||
|
|
||
| notExecuted := c.state.State == define.ContainerStateConfigured || c.state.State == define.ContainerStateCreated | ||
| if notExecuted { |
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.
Can use c.ensureState for this.
- Update documentation: Differentiate `unless-stopped` from `always` - containers stopped by the user before a reboot will not restart. - Add `should-start-on-boot` filter: Identify containers that require a restart after a system reboot. - Update command documentation: Add `restart-policy` and `label!` filters to the documentation for container commands (rm, ps, start, stop, pause, unpause, restart). - Add `restart-policy` and `shoud-start-on-boot` to completions. - Update service: Update `podman-restart.service` to use the `needs-restart=true` filter. - Preserve state: Preserve the `StoppedByUser` state across reboots. - Update API: Add a `ShouldStartOnBoot()` method to the Container API. - Update documentation: Add descriptions for the `should-start-on-boot` filter. Fixes: https://issues.redhat.com/browse/RHEL-129405 Fixes: containers#20418 Signed-off-by: Jan Rodák <[email protected]>
22bc44c to
4d3c631
Compare
|
@mheon I made changes based on your comments. |
|
LGTM |
|
/packit retest-failed |
Luap99
left a comment
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.
/lgtm
The duplication in the filter description is ugly as hell, we should create an issue and make the filter option de-duplicated like the rest unless I am overlooking something why it isn't right now.
|
/lgtm Thanks
It does work normally, I suppose this is just one of the typical bot issues where it is offline or misses messages for short time. One of the reason why we want to remove the bot. Let's see if this works now :) |
5508d87
into
containers:main
unless-stoppedfromalways- containers stopped by the user before a reboot will not restart.should-start-on-bootfilter: Identify containers that require a restart after a system reboot.restart-policyandlabel!filters to the documentation for container commands (rm, ps, start, stop, pause, unpause, restart).restart-policyandshoud-start-on-bootto completions.podman-restart.serviceto use theneeds-restart=truefilter.StoppedByUserstate across reboots.ShouldStartOnBoot()method to the Container API.should-start-on-bootfilter.Fixes: https://issues.redhat.com/browse/RHEL-129405
Fixes: #20418
Checklist
Ensure you have completed the following checklist for your pull request to be reviewed:
commits. (
git commit -s). (If needed, usegit commit -s --amend). The author email must matchthe sign-off email address. See CONTRIBUTING.md
for more information.
Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?