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
Give summary when client operation to containers failed #1156
Give summary when client operation to containers failed #1156
Conversation
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
PS: I replaced If anyone feels uncomfortable with this way, I can separate them and file a new PR for the wording replacement. :-) |
71a48ae
to
679af41
Compare
You don't have to split each command, please squash your commits. |
679af41
to
882d53b
Compare
squashed |
# delete nonexisting containers will report error | ||
runc delete non_exists1 non_exists2 | ||
[ "$status" -ne 0 ] | ||
[[ ${lines[-1]} =~ "failed to delete containers: non_exists1,non_exists2" ]] |
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.
You could just use ==
here and all other test cases.
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.
Fixed
When we failed to delete one or more containers, besides the error message for each container, we should give a more useful summary information e.g. "failed to delete containers: ctrA,ctrB", instead of "one or more of the container deletions failed", the old summary info is totally useless. This can also apply to `start`/`pause`/`resume` commands. Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
882d53b
to
3f41005
Compare
Isn't this just redundant information as its already printed to stderr along with the reason why it failed? |
@crosbymichael Considering that a user could By the way, this is also compliant to |
I don't really like this either. Not to mention that this summary output will stop making sense if someone created a container with |
Sad about that, to be honest, I really like the "summary". If @cyphar and @crosbymichael are both uncomfortable about this, I can remove them :-( currently we have some summary but provide useless info. What do you think? |
I think it really depends on how you are using it. To me its just redundant information because the failures are already printed to stderr so why print it again. If you are using this pragmatically there maybe better options for output, such as json output of a summary but we will still have to think about that more also. Overall, I'm not a fan of the current batch operations and think they add alot of noise to the output and its hard to reason about atomic operations when 1 out of 100 fail |
Actually there is another technical reason that we should do this. We need to return some error if the operation to multiple containers failed (see https://github.com/opencontainers/runc/pull/1156/files#diff-635f3cde55281671a8db5283d1597a71R103), then the If we don't return the "summary" information as error, we may have some other substitutions:
So comparing to previous 3 options, I think the "noise" is much better 😄 |
I'm actually starting to lean to what @crosbymichael said. The "batch" operations are quite confusing in some cases to users, especially when it comes to partial failures. I've never been a fan of Docker's |
This is only about preference and taste, not about right or wrong, so I think it should be fine. Besides, It's already part of runc, we can keep improving it, I don't think we have to revert this. |
Thinking about this more. I would like to propose that we remove all the multi container operations from runc. The feature look innocent when it was first proposed but after multiple PRs expanding this type of operations to other commands and seeing how errors and output are handled it shows that this is not a good design for runc and its not what it was built for, single container operations and nothing more. It also breaks the runtime spec actions as they all expect to call the actions with one id, not multiple. Since we are pre-1.0 I would like to remove these and go back to single ID operations. When I look at the code its so much more complex for even simple things. What does everyone think about this change? |
I completely agree with @crosbymichael. I also started feeling buyers remorse soon after the PR was merged, especially considering the "atomic operation" argument that was given above. |
I agree we can keep this behavior in runc simple and consistent, Since we all agree, I can work on a PR to revert that behavior. Close this one. |
As per the discussions in opencontainers#1156 , we think it's a bad idea to allow multi container operations in runc. So revert it. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
As per the discussions in opencontainers#1156 , we think it's a bad idea to allow multi container operations in runc. So revert it. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
As per the discussions in opencontainers#1156 , we think it's a bad idea to allow multi container operations in runc. So revert it. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
As per the discussions in opencontainers#1156 , we think it's a bad idea to allow multi container operations in runc. So revert it. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
As per the discussions in opencontainers#1156 , we think it's a bad idea to allow multi container operations in runc. So revert it. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
When we failed to delete one or more containers, besides the error
message for each container, we should give a more useful summary
information e.g. "failed to delete containers: ctrA,ctrB", instead of
"one or more of the container deletions failed", the old summary info is
totally useless.
Signed-off-by: Zhang Wei zhangwei555@huawei.com
Update: this can also apply to other commands including
start/pause/resume