From f416929738a3306007e523d3c938e80dc5a2d1ec Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Tue, 16 Aug 2016 10:16:47 -0600 Subject: [PATCH] check_console(): attempt a power cycle If the host is unresponsive and its power is on, reboot it. Signed-off-by: Zack Cerza --- teuthology/nuke.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/teuthology/nuke.py b/teuthology/nuke.py index b3dbf47e11..3a6f6f8057 100644 --- a/teuthology/nuke.py +++ b/teuthology/nuke.py @@ -400,19 +400,24 @@ def check_console(hostname): host=shortname, domain=config['ipmi_domain']) log.info('checking console status of %s' % cname) - if not console.check_status(): - # not powered on or can't get IPMI status. Try to power on - console.power_on() - # try to get status again - log.info('checking console status of %s' % cname) - if not console.check_status(timeout=100): - log.error( - "Failed to get console status for %s, " % cname - ) - else: - log.info('console ready on %s' % cname) + if console.check_status(): + log.info('console ready on %s' % cname) + return + if console.check_power('on'): + log.info('attempting to reboot %s' % cname) + console.power_cycle() else: + log.info('attempting to power on %s' % cname) + console.power_on() + timeout = 100 + log.info('checking console status of %s with timeout %s' % + (cname, timeout)) + if console.check_status(timeout=timeout): log.info('console ready on %s' % cname) + else: + log.error( + "Failed to get console status for %s, " % cname + ) def stale_openstack(ctx): -- 2.39.5