Skip to content
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

Merged
merged 4 commits into from
Apr 13, 2022

Conversation

WangXiangUSTC
Copy link
Collaborator

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

Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 1, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Andrewmatilde
  • cwen0

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot requested a review from Yiyiyimu March 1, 2022 10:14
@WangXiangUSTC WangXiangUSTC added the enhancement New feature or request label Mar 1, 2022
@WangXiangUSTC WangXiangUSTC changed the title support "both" direction for partition support "both" direction for network partition Mar 4, 2022
@WangXiangUSTC WangXiangUSTC requested review from Andrewmatilde and removed request for Yiyiyimu March 23, 2022 10:24
Copy link
Member

@Andrewmatilde Andrewmatilde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

Copy link
Member

@Andrewmatilde Andrewmatilde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WangXiangUSTC
Copy link
Collaborator Author

@cwen0 PTAL again

if n.Direction == "to" || n.Direction == "both" {
toChains, err = n.getPartitionChain(ipset, "to")
if err != nil {
return nil, errors.WithStack(err)
Copy link
Member

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.

Copy link
Collaborator Author

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

Copy link
Member

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.

if n.Direction == "from" || n.Direction == "both" {
fromChains, err = n.getPartitionChain(ipset, "from")
if err != nil {
return nil, errors.WithStack(err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@cwen0 cwen0 self-requested a review March 30, 2022 12:24
@WangXiangUSTC
Copy link
Collaborator Author

@cwen0 PTAL again

Signed-off-by: xiang <xiang13225080@163.com>
Copy link
Member

@cwen0 cwen0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cwen0
Copy link
Member

cwen0 commented Apr 13, 2022

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: a9bcb49

@ti-chi-bot ti-chi-bot merged commit e5e2c4c into chaos-mesh:main Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants