Skip to content

"docker swarm init --force-new-cluster" use limit #34881

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

Merged
merged 1 commit into from
Sep 27, 2017

Conversation

ityangchen
Copy link
Contributor

@ityangchen ityangchen commented Sep 18, 2017

Signed-off-by: yangchenliang yangchenliang@huawei.com

When worker executes docker swarm init --force-new-cluster,docker would hang.So only manager can process it.

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)


if !c.nr.nodeState.IsManager() {
return "", errors.New("This node is not a swarm manager. Worker nodes can't be used to modify cluster state. Please run this command on a manager node or promote the current node to a manager.")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be moved down into the section below where c.mu is locked, since I believe that mutex needs to be locked to access nodeState.

Also, lint is complaining about the error message, so you may need to work around that by moving the message into a string constant. Is there not already a suitable message we can reuse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I will modify it as soon as possible.

Signed-off-by: yangchenliang <yangchenliang@huawei.com>

When worker executor `docker swarm init
--force-new-cluster`,docker would hang.So only manager can process it.

Signed-off-by: yangchenliang <yangchenliang@huawei.com>
@thaJeztah
Copy link
Member

@aaronlehmann looks like the PR was updated

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah thaJeztah merged commit 0b968f9 into moby:master Sep 27, 2017
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.

4 participants