-
Notifications
You must be signed in to change notification settings - Fork 949
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
refactor: merge different validate funtions #1730
refactor: merge different validate funtions #1730
Conversation
@fuweid , please take a carefully review to see whether I miss something |
daemon/mgr/container.go
Outdated
// validate log config | ||
if err := mgr.validateLogConfig(container); err != nil { | ||
return nil, err | ||
Root: mgr.ContainerRoot(id), |
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.
Please consider the migration. If the container is existing, the Root
must be empty. I think we can use the util function to return the path. make senses?
ping @Ace-Tang CI fails according integration system. If this is flaky test, welcome to track this with profiling an issue. build url: https://travis-ci.org/alibaba/pouch/builds/404315435 |
Codecov Report
@@ Coverage Diff @@
## master #1730 +/- ##
==========================================
- Coverage 63.83% 63.82% -0.01%
==========================================
Files 201 201
Lines 15528 15526 -2
==========================================
- Hits 9912 9910 -2
+ Misses 4380 4379 -1
- Partials 1236 1237 +1
|
@@ -378,7 +373,7 @@ func (mgr *ContainerManager) Create(ctx context.Context, name string, config *ty | |||
amendContainerSettings(&config.ContainerConfig, config.HostConfig) | |||
|
|||
// validate container Config | |||
warnings, err := validateConfig(&config.ContainerConfig, config.HostConfig, false) | |||
warnings, err := mgr.validateConfig(container, false) |
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 do not think validation part should locate in the manager.
Is there anyways to locate them in the bridge layer?
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.
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.
Actually, we have lots of configs have related with daemon, so we cannot put validate into api bridge, that not make sense.
merge validateLogConfig into validateConfig, and move validate functions into file daemon/mgr/container_validation.go Signed-off-by: Ace-Tang <[email protected]>
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.
LGTM @Ace-Tang thanks !
merge validateLogConfig into validateConfig, and move validate functions
into file daemon/mgr/container_validation.go
Signed-off-by: Ace-Tang [email protected]
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews