From a1f3cac0b6800f9d58396173d81fd6817b98ed7f Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Tue, 9 Aug 2011 17:17:08 -0700 Subject: [PATCH] kernel: comment reconnect task, clean up reporting Signed-off-by: Greg Farnum --- teuthology/task/kernel.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/teuthology/task/kernel.py b/teuthology/task/kernel.py index 0322699cff79f..bf6d36aeed2a9 100644 --- a/teuthology/task/kernel.py +++ b/teuthology/task/kernel.py @@ -137,6 +137,19 @@ def install_and_reboot(ctx, config): def reconnect(ctx, timeout): + """ + Connect to all the machines in ctx.cluster. + + Presumably, some of them won't be up. Handle this + by waiting for them, unless the wait time exceeds + the specified timeout. + + ctx needs to contain the cluster of machines you + wish it to try and connect to, as well as a config + holding the ssh keys for each of them. As long as it + contains this data, you can construct a context + that is a subset of your full cluster. + """ log.info('Re-opening connections...') starttime = time.time() need_reconnect = ctx.cluster.remotes.keys() @@ -150,10 +163,13 @@ def reconnect(ctx, timeout): except socket.error as e: if hasattr(e, '__getitem__'): if e[0] not in [errno.ECONNREFUSED, errno.ETIMEDOUT, - errno.EHOSTUNREACH, errno.EHOSTDOWN] or \ - time.time() - starttime > timeout: + errno.EHOSTUNREACH, errno.EHOSTDOWN]: log.exception('unknown socket error: %s', repr(e)) raise + else if time.time() - starttime > timeout: + log.exception('timed out waiting for %s', remote.name) + raise + else: log.exception('weird socket error without error code') raise -- 2.39.5