#26346: docker volume inspect doesn't do partial ID matching#27317
#26346: docker volume inspect doesn't do partial ID matching#27317bbayani wants to merge 1 commit intomoby:masterfrom
Conversation
05d6dea to
a089cc8
Compare
e14d06c to
2ab2b17
Compare
|
Thanks @bbayani - looks like there's some linting issues; |
|
ping @bbayani can you look at the failing CI? |
c6010e8 to
d8374e4
Compare
|
If we really need to support prefix matching, we should use go-patricia like we do for containers. |
|
@cpuguy83 : you commented on issue that you would not prefer go-patricia stuff as you are planning on removing it. Thus implemented the walking for entire volume list. Let me know if you have changed mind. I should implement similar prefix matching to containers. |
|
We can use it while it's there, but I'm also hoping to get a PR in soon that does indeed remove it, so it may be for naught. |
|
How can I help move this forward? |
|
I am not clear. Should I use go-patria approach or not? |
70dc20c to
db7030f
Compare
|
Also, i am not able to understand the failing unit test in docker_api_containers_test.go.. Can someone guide? |
|
@bbayani the test checks if an anonymous volume is automatically removed when the container is removed. Possibly due to the prefix matching, a different volume with the same prefix (e.g. |
2ea69cb to
35d787f
Compare
Adressing golint failures Addressing unit test failures Addressing gofmt failure Signed-off-by: Bhumika Bayani <bhumikabayani@gmail.com>
de7ef52 to
a5644ef
Compare
|
Thanks @thaJeztah! The unit tests are passing now. |
|
@thaJeztah All tests are passing now. Can you please let me know if there any more changes needed? |
|
Actually, looking at this change, I wonder if this is actually correct. For example; Trying to match partial names always returns an error; Only a partial ID works; But produces an error if multiple results were found; (Note that the error is incorrect, as it doesn't include the partial ID provided, which is something we should address) Same for images: (this error message is inconsistent, so may have to be updated) And for networks: (this error message is inconsistent, so may have to be updated) |
|
With the changes in this PR, partial lookup for volume names is implemented; However, if multiple matches are possible, the first one is used; I think that;
ping @jhowardmsft @cpuguy83 WDYT? |
|
I'm moving this back to design review per the above (sorry @bbayani, not your fault, just now realized we would not be consistent, so this requires additional discussion) |
|
@thaJeztah no issues, once you guys decide on design, I can make required changes in this PR itself? Thanks! |
|
@bbayani Thanks for submitting this. In a maintainers meeting we decided that since we don't currently do partial matching on names of other objects it's best not to add them here, for now. This is not to say this is forever a no, just not at this time. |
|
@thaJeztah Can this be re-visited to match by partial- |
|
@jhowardmsft the problem is that volumes don't have an ID, only a name. Perhaps it's possible to add the option of having ID's to volumes at some point |
|
@thaJeztah Not quite true.... |
|
Well half and half - the name is an ID. Which is horrible when it comes to attempting to delete it. |
|
Yes, it's a random name, and it "looks" like an ID. I'd personally be +1 if there was a way to give volumes an ID to be consistent with all other objects we have |
fixes #26346
- What I did
Implemented code for performing partial ID matching for docker volumes (ID is name for volumes)
- How I did it
Added method GetVolumesByName. It iterates over all volumes in daemon volume store and returns the list of volumes whose names match with passed prefix
- How to verify it
docker volume inspect test1
docker inspect test1
docker volume inspect te
docker inspect te
docker volume inspect abc -> no such volume: abc
docker inspect abc -> no such container/network/volume/service
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)
