]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Move reboot() to teuthology.misc
authorZack Cerza <zack@cerza.org>
Wed, 12 Feb 2014 17:01:37 +0000 (11:01 -0600)
committerZack Cerza <zack@cerza.org>
Thu, 20 Feb 2014 23:46:08 +0000 (17:46 -0600)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/misc.py
teuthology/task/devstack.py

index 2f455d90c7c51524265351f53c772e1acfd06def..ea61c1208f31b360a32890e763235e5fc1a321ea 100644 (file)
@@ -891,6 +891,31 @@ def wait_until_fuse_mounted(remote, fuse, mountpoint):
     log.info('ceph-fuse is mounted on %s', mountpoint)
 
 
+def reboot(node, timeout=300, interval=30):
+    """
+    Reboots a given system, then waits for it to come back up and
+    re-establishes the ssh connection.
+
+    :param node: The teuthology.orchestra.remote.Remote object of the node
+    :param timeout: The amount of time, in seconds, after which to give up
+                    waiting for the node to return
+    :param interval: The amount of time, in seconds, to wait between attempts
+                     to re-establish with the node. This should not be set to
+                     less than maybe 10, to make sure the node actually goes
+                     down first.
+    """
+    log.info("Rebooting {host}...".format(host=node.hostname))
+    node.run(args=['sudo', 'shutdown', '-r', 'now'])
+    reboot_start_time = time.time()
+    while time.time() - reboot_start_time < timeout:
+        time.sleep(interval)
+        if node.is_online or node.reconnect():
+            return
+    raise RuntimeError(
+        "{host} did not come up after reboot within {time}s".format(
+            host=node.hostname, time=timeout))
+
+
 def reconnect(ctx, timeout, remotes=None):
     """
     Connect to all the machines in ctx.cluster.
index 07a7961e56f3554164f8c084e3a90d9efe008823..a249c8b45aadf4a86b837a372c396845c047a218 100644 (file)
@@ -81,7 +81,7 @@ def configure_devstack_and_ceph(ctx, config, devstack_node, ceph_node):
     update_devstack_config_files(devstack_node, secret_uuid)
     set_apache_servername(devstack_node)
     # Rebooting is the most-often-used method of restarting devstack services
-    reboot(devstack_node)
+    misc.reboot(devstack_node)
     start_devstack(devstack_node)
     restart_apache(devstack_node)
 
@@ -256,31 +256,6 @@ def set_apache_servername(node):
                          "ServerName {name}".format(name=hostname))
 
 
-def reboot(node, timeout=300, interval=30):
-    """
-    Reboots a given system, then waits for it to come back up and
-    re-establishes the ssh connection.
-
-    :param node: The teuthology.orchestra.remote.Remote object of the node
-    :param timeout: The amount of time, in seconds, after which to give up
-                    waiting for the node to return
-    :param interval: The amount of time, in seconds, to wait between attempts
-                     to re-establish with the node. This should not be set to
-                     less than maybe 10, to make sure the node actually goes
-                     down first.
-    """
-    log.info("Rebooting {host}...".format(host=node.hostname))
-    node.run(args=['sudo', 'shutdown', '-r', 'now'])
-    reboot_start_time = time.time()
-    while time.time() - reboot_start_time < timeout:
-        time.sleep(interval)
-        if node.is_online or node.reconnect():
-            return
-    raise RuntimeError(
-        "{host} did not come up after reboot within {time}s".format(
-            host=node.hostname, time=timeout))
-
-
 def start_devstack(devstack_node):
     log.info("Patching devstack start script...")
     # This causes screen to start headless - otherwise rejoin-stack.sh fails