]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
check_console(): attempt a power cycle
authorZack Cerza <zack@redhat.com>
Tue, 16 Aug 2016 16:16:47 +0000 (10:16 -0600)
committerZack Cerza <zack@redhat.com>
Tue, 16 Aug 2016 23:07:33 +0000 (17:07 -0600)
If the host is unresponsive and its power is on, reboot it.

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/nuke.py

index b3dbf47e1114c8174ab32a2c589ee49d231ed7e5..3a6f6f80579b189330d65364848a961ccb89201d 100644 (file)
@@ -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):