WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@tobwen
Copy link
Contributor

@tobwen tobwen commented Aug 16, 2025

Does this PR introduce a user-facing change?

Yes.

* Added `--pinned` flag to `volume create` to create pinned volumes
* Added new `volume pin` commands to pin/unpin existing volumes
* Added `--include-pinned` flag to `volume rm` to allow removing pinned volumes
* Added pinned volume filtering support
* Added support for pinned volumes in `system prune` command
* Added HTTP API and ABI support for volume pinning
* Added runtime methods for handling pinned volumes and pruning

References

Reference #26807
Reference #23217

Actions required

  • This is just the first step to demonstrate the function. Things like tunnel/remote implementation are still missing (it's just a stub).
  • It needs to be discussed if we want to overload the CLI with volume unpin or rather use volume pin --unpin as supplied.

Note

Those are my first steps with the Podman code - please bear with me.

@openshift-ci openshift-ci bot added release-note do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Aug 16, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 16, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tobwen
Once this PR has been reviewed and has the lgtm label, please assign ygalblum for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mheon
Copy link
Member

mheon commented Aug 18, 2025

Should pinned volumes require --force to remove? It feels like they ought to

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"`
Copy link
Member

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
Copy link
Member

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()

@tobwen
Copy link
Contributor Author

tobwen commented Aug 18, 2025

Should pinned volumes require --force to remove? It feels like they ought to

I've thought about that before, but I figured we should treat it like the immutable flag. If this flag is set, even root can't remove a file with rm -f either. My concern here is protecting important data, and maybe root has some stupid script that sets --force to keep the script running - but then the data is gone (excluding backups for now).

@packit-as-a-service
Copy link

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

3 similar comments
@packit-as-a-service
Copy link

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@packit-as-a-service
Copy link

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@packit-as-a-service
Copy link

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@github-actions
Copy link

github-actions bot commented Oct 2, 2025

A friendly reminder that this PR had no activity for 30 days.

@tobwen
Copy link
Contributor Author

tobwen commented Oct 2, 2025

So sad... all the work for nothing.

@mheon
Copy link
Member

mheon commented Oct 2, 2025

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.

var (
pinDescription = `Mark or unmark a volume as pinned.
Pinned volumes are excluded from system prune operations by default.`
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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"`
Copy link
Member

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

Copy link
Contributor Author

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.

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]>
@tobwen tobwen force-pushed the podman-26807 branch 6 times, most recently from 3ce51dc to 48c756b Compare December 11, 2025 01:51
* 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]>
@tobwen tobwen force-pushed the podman-26807 branch 3 times, most recently from 153085b to 7b15df9 Compare December 11, 2025 03:11
Signed-off-by: tobwen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/api-change Change to remote API; merits scrutiny release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants