-
Notifications
You must be signed in to change notification settings - Fork 63
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
support "both" direction for network partition #136
support "both" direction for network partition #136
Conversation
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
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.
Rest LGTM
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
@cwen0 PTAL again |
pkg/core/network.go
Outdated
if n.Direction == "to" || n.Direction == "both" { | ||
toChains, err = n.getPartitionChain(ipset, "to") | ||
if err != nil { | ||
return nil, errors.WithStack(err) |
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 the error is returned by function inside the Chaos Mesh, we could assume this error is already equipped with a stack backtrace, so there is no need to call errors.WithStack
.
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.
The function getPartitionChain
only returns an error when direction
is neither to
nor from
, the error is not from Chaos Mesh
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.
The error of getPartitionChain
was generated by errors.New
, which has equipped with a stack backtrace. So we don't need to use 'errors.WithStack` here.
pkg/core/network.go
Outdated
if n.Direction == "from" || n.Direction == "both" { | ||
fromChains, err = n.getPartitionChain(ipset, "from") | ||
if err != nil { | ||
return nil, errors.WithStack(err) |
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.
ditto
@cwen0 PTAL again |
Signed-off-by: xiang <xiang13225080@163.com>
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
/merge |
This pull request has been accepted and is ready to merge. Commit hash: a9bcb49
|
Now only support direction "from" and "to" for partition, users need to run chaosd command twice if they want to partition both "from" and "to".
This pr close issue #127