-
Notifications
You must be signed in to change notification settings - Fork 950
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
bugfix: add attach volume when container start #1483
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1483 +/- ##
==========================================
+ Coverage 41.25% 41.32% +0.06%
==========================================
Files 255 255
Lines 16837 16874 +37
==========================================
+ Hits 6946 6973 +27
- Misses 9024 9031 +7
- Partials 867 870 +3
|
@@ -26,6 +26,9 @@ type Driver interface { | |||
type Opt interface { | |||
// Options return module customize volume options. | |||
Options() map[string]types.Option | |||
|
|||
// Config is used to pass the daemon volume configure into driver. | |||
Config(Context, map[string]interface{}) error |
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 think the Driver interface should implement Config method, not the Opt interface. WDYT? @rudyfly
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 have refacted it, PTAL 😄
daemon/mgr/container.go
Outdated
continue | ||
} | ||
|
||
attachedVolumes := map[string]struct{}{} |
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 it necessary to add a defer in a loop
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.
oh, it should defer outside the loop
85a41b9
to
05c8472
Compare
Add attach volume when container start. Now volume attaching is at container create stage, but if host have been restarted, container won't be created, so volume can't be attached. Add Config() for volume driver, it makes volume driver can use the configure of volume in daemon. Now set `volume-meta-dir` and `volume-timeout` into driver config. Signed-off-by: Rudy Zhang <rudyflyzhang@gmail.com>
Ⅰ. Describe what this PR did
Add attach volume when container start. Now volume attaching is
at container create stage, but if host have been restarted, container won't be
created, so volume can't be attached.
Add Config() for volume driver, it makes volume driver can use the
configure of volume in daemon. Now set
volume-meta-dir
andvolume-timeout
into driver config.Ⅱ. Does this pull request fix one issue?
NONE
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
A running container can start again after host have been restarted.
Ⅴ. Special notes for reviews
Signed-off-by: Rudy Zhang rudyflyzhang@gmail.com