Volume QA, "volume remove" (fixes and tests)#3125
Merged
AkihiroSuda merged 1 commit intocontainerd:mainfrom Jun 20, 2024
Merged
Volume QA, "volume remove" (fixes and tests)#3125AkihiroSuda merged 1 commit intocontainerd:mainfrom
AkihiroSuda merged 1 commit intocontainerd:mainfrom
Conversation
apostasie
commented
Jun 20, 2024
|
|
||
| var volumenames []string // nolint: prealloc | ||
| for _, name := range volumes { | ||
| volume, err := volStore.Get(name, false) |
Contributor
Author
There was a problem hiding this comment.
This section serves no purpose, and does make things racy.
apostasie
commented
Jun 20, 2024
| } | ||
| removedNames, err := volStore.Remove(volumenames) | ||
| // if err is set, this is a hard filesystem error | ||
| removedNames, errs, err := volStore.Remove(volumenames) |
Contributor
Author
There was a problem hiding this comment.
Note that on such a dramatic error (filesystem failure typically), we do not report whether and which volumes were (possibly) successfully removed.
I think it is fine - the only reason this would happen is if os.RemoveAll would err.
apostasie
commented
Jun 20, 2024
| if err != nil { | ||
| return err | ||
| } | ||
| // Otherwise, output on stdout whatever was successful |
Contributor
Author
There was a problem hiding this comment.
This and following is to match docker behavior on multi remove:
- first output the list of successfully removed volumes
- then output the errors
- exit 1 if there was any error
apostasie
commented
Jun 20, 2024
| } | ||
|
|
||
| if err := lockutil.WithDirLock(vs.dir, fn); err != nil { | ||
| if err := lockutil.WithDirLock(vs.dir, fn); err != nil && !errors.Is(err, os.ErrExist) { |
Contributor
Author
There was a problem hiding this comment.
This to match docker behavior.
Repeat "create" of the same volume should not error.
apostasie
commented
Jun 20, 2024
Contributor
Author
|
@AkihiroSuda CI is green and linter is happy. |
AkihiroSuda
reviewed
Jun 20, 2024
AkihiroSuda
reviewed
Jun 20, 2024
AkihiroSuda
reviewed
Jun 20, 2024
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
Contributor
Author
|
@AkihiroSuda your suggestion integrated in and pushed. I am logging of now. See you later. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes #3124 and a few other discrepancies between docker and nerdctl.
This also expands testing significantly.
Outside of the tests, I will comment inline as to "why" certain changes.