-
Notifications
You must be signed in to change notification settings - Fork 2.9k
WIP: volume protection by pinning #26846
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
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tobwen The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Should pinned volumes require |
libpod/volume.go
Outdated
| MountLabel string `json:"mountlabel,omitempty"` | ||
| // Pinned indicates that this volume should be excluded from | ||
| // system prune operations by default | ||
| Pinned bool `json:"pinned,omitempty"` |
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 better to stick this in state, since it can be toggled on/off
libpod/volume.go
Outdated
| return err | ||
| } | ||
|
|
||
| v.config.Pinned = pinned |
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.
Yeah, this won't work with v.config - that's static data, never changes. You want v.state - which is refreshed by update() and saved by save()
I've thought about that before, but I figured we should treat it like the |
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
3 similar comments
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
|
A friendly reminder that this PR had no activity for 30 days. |
|
So sad... all the work for nothing. |
|
We generally don't review things until CI starts passing. In this case, looks like it's yelling about missing a manpage for the new commands? I can do a more thorough review early next week. |
cmd/podman/volumes/pin.go
Outdated
| var ( | ||
| pinDescription = `Mark or unmark a volume as pinned. | ||
| Pinned volumes are excluded from system prune operations by default.` |
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.
System reset still catches them, yes?
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.
That's a thing we should discuss... My main intention for pinning is to help inexperienced DevOps who are close to reaching capacity limits on their live systems, then execute prune or reset for some reason, and then realize that the volume containing their live database is gone and the backup is two days old.
After checking the implementation I found that Reset() was NOT respecting the pinned flag. Thanks, I fixed this.
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.
I've added an optional solution for reset: #26846 (comment)
| GID *int `schema:"gid"` | ||
| // Pinned indicates that this volume should be excluded from | ||
| // system prune operations by default | ||
| Pinned bool `schema:"pinned"` |
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.
Is there a good reason for this? It feels more natural to podman volume create + podman volume pin but I suppose that could be racey
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.
While podman volume create + podman volume pin would work, there's a window where the volume could be pruned between those two commands. I added a comment explaining this is to avoid race conditions when atomically creating and pinning a volume.
Signed-off-by: tobwen <[email protected]>
Signed-off-by: tobwen <[email protected]>
Signed-off-by: tobwen <[email protected]>
see discussion in containers#23217 Signed-off-by: tobwen <[email protected]>
Signed-off-by: tobwen <[email protected]>
Signed-off-by: tobwen <[email protected]>
Signed-off-by: tobwen <[email protected]>
Signed-off-by: tobwen <[email protected]>
Signed-off-by: tobwen <[email protected]>
Signed-off-by: tobwen <[email protected]>
Signed-off-by: tobwen <[email protected]>
Signed-off-by: tobwen <[email protected]>
Signed-off-by: tobwen <[email protected]>
Signed-off-by: tobwen <[email protected]>
Adds a new flag `--include-pinned` to podman system reset that allows users to optionally include pinned volumes in the reset operation. Previously, pinned volumes were always excluded from being reset. This change: - Updates warning messages to correctly reflect volume behavior - Modifies the reset functionality to respect the new inclusion flag - Propagates the new option through the system architecture - Clarifies in the prune warning message that pinned volumes are optionally included Signed-off-by: tobwen <[email protected]>
Signed-off-by: tobwen <[email protected]>
3ce51dc to
48c756b
Compare
* Renames the global variable 'includePinned' to 'resetIncludePinned' to improve code clarity and prevent potential variable shadowing. * Adds SystemResetOptions type alias to the entities package. Signed-off-by: tobwen <[email protected]>
Updates Podman package import references from version 5 to version 6. Signed-off-by: tobwen <[email protected]>
153085b to
7b15df9
Compare
Signed-off-by: tobwen <[email protected]>
Does this PR introduce a user-facing change?
Yes.
References
Reference #26807
Reference #23217
Actions required
volume unpinor rather usevolume pin --unpinas supplied.Note
Those are my first steps with the Podman code - please bear with me.