-
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
refactor: make code more encapsulate and logic simple #1540
refactor: make code more encapsulate and logic simple #1540
Conversation
99ed11b
to
0cc66df
Compare
Codecov Report
@@ Coverage Diff @@
## master #1540 +/- ##
===========================================
+ Coverage 17.7% 41.29% +23.58%
===========================================
Files 214 257 +43
Lines 14367 16988 +2621
===========================================
+ Hits 2544 7015 +4471
+ Misses 11660 9101 -2559
- Partials 163 872 +709
|
Please help to review this pull request. @HusterWan @Letty5411 #!/bin/sh
set -x
set -e
while true ; do
containerName=ziren
pouch run -d --name $containerName busybox
pouch restart -t 1 $containerName
pouch rm -f $containerName
pouch ps -a
sleep 2
done And it works fine with no legacy container exists on the local machine. Please help to check and review this. But there is still a log in pouchd's log:
I think this is normal, since it is totally right from user's perspective. |
daemon/mgr/container.go
Outdated
if err != nil && !errtypes.IsNotfound(err) { | ||
return errors.Wrapf(err, "failed to destroy container %s", c.ID) | ||
return errors.Wrapf(err, "failed to destroy container %s when restarting", c.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.
%s/restarting/remove ?
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.
updated, thanks.
LGTM |
0cc66df
to
743c2f4
Compare
} | ||
// Remove io and network config may occur error, so we should update | ||
// container's status on disk as soon as possible. | ||
defer func() { |
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.
if Write
failed, we can do nothing to recover, just record my confuse.
if err := m.RawError(); err != nil { | ||
fmt.Fprintf(io.Stdout, "%v\n", err) | ||
} | ||
io := mgr.IOs.Get(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.
change the codes below to releaseContainerIOs
?
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 we could do such change. since in the middle of the function, there is a fmt.Fprintf(io.Stdout, "%v\n", err)
d429700
to
cb93ee2
Compare
I have no more opinion about this PR, so when the ci pass, i will merge it. LGTM |
6e2b2f5
to
91e22c3
Compare
Signed-off-by: Allen Sun <allensun.shl@alibaba-inc.com>
91e22c3
to
b126b02
Compare
Signed-off-by: Allen Sun allensun.shl@alibaba-inc.com
Ⅰ. Describe what this PR did
This pull request did these things:
SetStatusExited
stopped
inmarkExitedAndRelease
;stopped
inRemove
action.Ⅱ. Does this pull request fix one issue?
none
Ⅲ. Describe how you did it
none
Ⅳ. Describe how to verify it
none
Ⅴ. Special notes for reviews
none