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

Improve handling when not all loopback addresses are available #461

Merged
merged 1 commit into from
Mar 9, 2016
Merged

Improve handling when not all loopback addresses are available #461

merged 1 commit into from
Mar 9, 2016

Conversation

bcantoni
Copy link
Contributor

@bcantoni bcantoni commented Mar 7, 2016

On Mac the user needs to make sure the loopback addresses (127.0.0.2, 127.0.0.3, etc.)
are created. Currently if they aren't created, ccm fails when creating the cluster,
but leaves it in a partial state (usually just the first node is running).

This change does a pre-flight check to make sure all loopbacks are available, print
a better warning, and exit before starting any nodes.

@@ -314,6 +315,15 @@ def start(self, no_wait=False, verbose=False, wait_for_binary_proto=False,

common.assert_jdk_valid_for_cassandra_version(self.cassandra_version())

# check whether all loopback aliases are available before starting any nodes
for node in list(self.nodes.values()):
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think building a list, here or in the line below, is necessary.

@mambocab
Copy link
Contributor

mambocab commented Mar 7, 2016

Other than my little nit about building lists, this looks good. I'll let @ptnapoleon do the final review, though, when he's back online.

@bcantoni
Copy link
Contributor Author

bcantoni commented Mar 7, 2016

@mambocab thanks - I've updated to remove those extra list() and improved the error message a bit; I'll squash after reviews

if itf is not None:
if not common.check_socket_available(itf, return_on_error=True):
addr, port = itf
print "Inet address %s:%s is not available; a cluster may already be running or you may need to add the loopback alias" % (addr, port)
Copy link
Contributor

Choose a reason for hiding this comment

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

You will need to from six import print_, and then use the print_ function here, to maintain compatibility across python 2 and 3.

@ptnapoleon
Copy link
Contributor

+1 after the Python2/3 compat fix.

On Mac the user needs to make sure the loopback addresses (127.0.0.2, 127.0.0.3, etc.)
are created. Currently if they aren't created, ccm fails when creating the cluster,
but leaves it in a partial state (usually just the first node is running).

This change does a pre-flight check to make sure all loopbacks are available, print
a better warning, and exit before starting any nodes.
@bcantoni
Copy link
Contributor Author

bcantoni commented Mar 8, 2016

Review comments addressed and commits squashed - should be ready to go

ptnapoleon added a commit that referenced this pull request Mar 9, 2016
Improve handling when not all loopback addresses are available
@ptnapoleon ptnapoleon merged commit 4732608 into riptano:master Mar 9, 2016
@bcantoni bcantoni deleted the improve-loopback-error branch April 13, 2016 21:32
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.

None yet

3 participants