-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
When calling volume driver Mount, send opaque ID #21015
Conversation
yay |
@@ -485,16 +486,18 @@ func (container *Container) CopyImagePathContent(v volume.Volume, destination st | |||
return err | |||
} | |||
|
|||
path, err := v.Mount() | |||
id := stringid.GenerateNonCryptoID() |
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.
Why a non-cryptographically strong ID? Presumably uniqueness is important.
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.
We generally use non-crypto for these sort of IDs (even container ID's are non-crypto). These are going to be relatively short-lived and not likely to conflict (and not catastrophic if they happen to).
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.
It'd be pretty catastrophic for me (the bug that got us here in the
first place) if there were duplicates. Can we just ensure no other
containers have the ID and re-roll if needed?
-Erik
On 8 Mar 2016, at 12:25, Brian Goff wrote:
@@ -485,16 +486,18 @@ func (container *Container)
CopyImagePathContent(v volume.Volume, destination st
return err
}
- path, err := v.Mount()
- id := stringid.GenerateNonCryptoID()
We generally use non-crypto for these sort of IDs (even container ID's
are non-crypto). These are going to be relatively short-lived and not
likely to conflict (and not catastrophic if they happen to).
Reply to this email directly or view it on GitHub:
https://github.com/docker/docker/pull/21015/files#r55421645
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.
Not sure, but non-cryptographically
doesn't say non-unique
, only "possibly predictable", or am I mistaken here? i.e. a UUID may be predictable, thus "non-crypto", but still is unique
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.
In addition, we could never guarantee this across hosts anyway.
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 I didn't mean that, sorry if I was implying otherwise. just ensure that no two existing mounts have the same ID and I'll be fine at least, I think.
63616e3
to
f40e40f
Compare
f40e40f
to
2f46533
Compare
Is this going to be available in 1.11? |
ping @cpuguy83 looks like this needs a rebase |
I'll deal with rebase if we move this to code-review. |
@cpuguy83 please tell me this is going to be in 1.11... |
@erikh Nope. |
@cpuguy83 REBASE!! :P |
2f46533
to
5da34d9
Compare
@tiborvass DONE!! |
LGTM 🐯 |
ping @cpuguy83 needs a rebase again 😢 ping @tiborvass PTAL |
yay!, one more part i needed :) and docs LGTM |
This generates an ID string for calls to Mount/Unmount, allowing drivers to differentiate between two callers of `Mount` and `Unmount`. Signed-off-by: Brian Goff <[email protected]>
5da34d9
to
2b6bc29
Compare
rebased |
LGTM |
docs LGTM 🐸 |
I'm playing with docker 1.12.0-rc5. I see the unique id in the /VolumeDriver.Mount request, but always see an empty string in the /VolumeDriver.Unmount request. Is this expected? I was hoping to verify the ID during the unmount request. Perhaps I'm overthinking this. Below is an example where 2 containers request the same volume (called swarm5), then exit. Note that the ID is sent in the Mount request, but not the Unmount request. Thanks! /VolumeDriver.Mount request={"Name":"swarm5","ID":"dfce4a5f374a573a6f36f2bd78907e2b90191aae54b70957e46a79629ba7af02"} response={"Mountpoint":"/data/swarm5","Err":null} /VolumeDriver.Mount request={"Name":"swarm5","ID":"ddce68c10c1afe245af1880df68076074c578d2bdb2a22731263a65bc2a97c38"} response={"Mountpoint":"/data/swarm5","Err":null} /VolumeDriver.Unmount request={"Name":"swarm5","ID":""} response={"Err":null} |
that is definitely going to make this ineffective for my needs. On Wed, Jul 27, 2016 at 5:40 PM, e4jet [email protected] wrote:
|
I worked around it by tracking state outside docker in both copy and nocopy On Thu, Jul 28, 2016 at 12:16 AM, Sebastiaan van Stijn <
|
@thaJeztah & @erikh thanks for the quick response. I can't think of a compelling reason for the engine to have to track this, so I'll take the same approach as @erikh. The only enhancement that I can think of would be to pass the container's uuid instead of creating an opaque one. This would allow some correlation for reporting and debugging. Cheers |
Unfortunately even though I originally asked for this feature, I agree; On Thu, Jul 28, 2016 at 4:57 PM, e4jet [email protected] wrote:
|
the state tracking is independent, I just have a global mutex protecting a as for querying docker, it'd be great if I could send a signal or when Sorry for the braindump but I have extremely little time these days and am On Fri, Jul 29, 2016 at 9:20 AM, Brian Goff [email protected]
|
@@ -124,6 +125,8 @@ name. This is called once per container start. If the same volume_name is reques | |||
more than once, the plugin may need to keep track of each new mount request and provision | |||
at the first mount request and deprovision at the last corresponding unmount request. | |||
|
|||
`ID` is a unqiue ID for the caller that is requesting the mount. |
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.
typo "unqiue"
This generates an ID string for calls to Mount/Unmount, allowing drivers
to differentiate between two callers of
Mount
andUnmount
.Fixes #20939