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

Add an explicit flag to join network in diagnostic #2087

Merged
merged 1 commit into from
Feb 23, 2018

Conversation

fcrisciani
Copy link

Usually a diagnostic session wants to check the local state
without this flag the network is joined and left every iteration
altering actually the daemon status.
Also if the diagnostic client is used against a live node, the
network leave has a very bad side effect of kicking the node
out of the network killing its internal status.
For the above reason introducing the flag -a to be explicit
so that the current state is always preserved

Signed-off-by: Flavio Crisciani [email protected]

Copy link
Contributor

@ddebroy ddebroy left a comment

Choose a reason for hiding this comment

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

LGTM with one q.

networkPeers = fetchNodePeers(*ipPtr, *portPtr, *networkPtr)
joinedNetwork = true
if len(networkPeers) == 0 {
logrus.Warnf("There is no peer on network %q, check the network ID, and verify that is the non truncated version", *networkPtr)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it safe to continue here rather than exit with fatalf?

Copy link
Author

Choose a reason for hiding this comment

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

yep it is, the output will only show no peers on the network and the validation with the entries will show a warning like:

WARN[0000] The element with key:23591a2e3795dc36c994eae6074239c91a9e647784af374cea1abf33373acb07 does not belong to any node on this network                                                                                                                                    

Copy link
Contributor

Choose a reason for hiding this comment

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

ok .. thanks!

@fcrisciani fcrisciani requested a review from ctelfer February 23, 2018 19:32
@codecov-io
Copy link

codecov-io commented Feb 23, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@daa47e8). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2087   +/-   ##
=========================================
  Coverage          ?   40.39%           
=========================================
  Files             ?      139           
  Lines             ?    22352           
  Branches          ?        0           
=========================================
  Hits              ?     9028           
  Misses            ?    11997           
  Partials          ?     1327

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update daa47e8...47c28fe. Read the comment docs.

Copy link
Contributor

@ddebroy ddebroy left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -199,8 +199,18 @@ The following flags are supported:
| -ip <string> | The IP address to query. Defaults to 127.0.0.1. |
| -net <string> | The target network ID. |
| -port <int> | The target port. (default port is 2000) |
| -a | join/leave network |
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a minor nit: change join to Join to align with the descriptions above and below.

Copy link
Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@ctelfer ctelfer left a comment

Choose a reason for hiding this comment

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

LGTM

Usually a diagnostic session wants to check the local state
without this flag the network is joined and left every iteration
altering actually the daemon status.
Also if the diagnostic client is used against a live node, the
network leave has a very bad side effect of kicking the node
out of the network killing its internal status.
For the above reason introducing the flag -a to be explicit
so that the current state is always preserved

Signed-off-by: Flavio Crisciani <[email protected]>
@fcrisciani fcrisciani merged commit 9cdb30e into moby:master Feb 23, 2018
@fcrisciani fcrisciani deleted the join-flag branch February 23, 2018 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants