]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Always run tests with latest kernel on RHEL
authorVasu Kulkarni <vasu@redhat.com>
Mon, 20 Mar 2017 16:52:33 +0000 (09:52 -0700)
committerVasu Kulkarni <vasu@redhat.com>
Mon, 20 Mar 2017 16:52:33 +0000 (09:52 -0700)
Signed-off-by: Vasu Kulkarni <vasu@redhat.com>
teuthology/task/kernel.py

index 1b14617924d6b5275a3d601d0e3c25fc22df550f..ce5868d9b01ef7b0793f8e4b4b7ab0e5a729f9b7 100644 (file)
@@ -10,6 +10,7 @@ import shlex
 import urlparse
 
 from teuthology import misc as teuthology
+from teuthology.parallel import parallel
 from teuthology.config import config as teuth_config
 from ..orchestra import run
 from ..exceptions import (
@@ -441,6 +442,41 @@ def _no_grub_link(in_file, remote, kernel_ver):
     )
 
 
+def install_latest_rh_kernel(ctx, config):
+    """
+    Installs the lastest z stream kernel
+    Reboot for the new kernel to take effect
+    """
+    if config is None:
+        config = {}
+    if config.get('skip'):
+        return
+    with parallel() as p:
+        for remote in ctx.cluster.remotes.iterkeys():
+            p.spawn(update_rh_kernel, remote)
+
+
+def update_rh_kernel(remote):
+    package_type = remote.os.package_type
+    output = StringIO()
+    remote.run(args=['uname', '-a'])
+    import time
+    if package_type == 'rpm':
+        remote.run(args=['sudo', 'yum', 'update', '-y', 'kernel'],
+                   stdout=output)
+        log.info(output.getvalue())
+        if not output.getvalue().find("Installed") == -1:
+            log.info("Kernel updated to latest z stream on %s", remote.shortname)
+            log.info("Rebooting %s", remote.shortname)
+            remote.run(args=['sudo', 'shutdown', '-r', 'now'], wait=False)
+            time.sleep(40)
+            log.info("Reconnecting after reboot")
+            remote.reconnect(timeout=300)
+            remote.run(args=['uname', '-a'])
+        elif not output.getvalue().find('No packages marked for update') == -1:
+            log.info("Latest version already installed on %s", remote.shortname)
+
+
 def install_and_reboot(ctx, config):
     """
     Install and reboot the kernel.  This mostly performs remote