]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
kernel: add kernel version matching code for opensuse 1527/head
authorNathan Cutler <ncutler@suse.com>
Tue, 30 Jun 2020 12:14:45 +0000 (14:14 +0200)
committerNathan Cutler <ncutler@suse.com>
Fri, 3 Jul 2020 13:39:30 +0000 (15:39 +0200)
The current code for checking if the running kernel version matches the
most recent kernel version in the repos does not work on opensuse when
"-k distro" is given.

This commit adds an opensuse-specific codepath with a version match
check that works in the opensuse testing environment.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
teuthology/task/kernel.py

index f71b16cbd42077bfe153963de61a031de29f4b72..73f8071a0f579d7678a7303bbf03411e8f1e648b 100644 (file)
@@ -188,10 +188,22 @@ def need_to_install(ctx, role, version):
                                                                  want=version))
 
     if '.' in str(version):
-        # version is utsrelease, yay
         if cur_version == version:
             log.debug('utsrelease strings match, do not need to install')
             ret = False
+        os_type = teuthology.get_distro(ctx)
+        log.debug("Distro of this test job: {}".format(os_type))
+        if os_type in ['sle', 'opensuse']:
+            cur_version_match = re.search('(.*)-default$', cur_version)
+            if cur_version_match:
+                cur_version_rp = cur_version_match.group(1)
+                if cur_version_rp in version:
+                    log.debug('"{}" is a substring of "{}" - the latest {} kernel is running'
+                              .format(cur_version_rp, version, os_type))
+                    ret = False
+            else:
+                log.debug('failed to parse current kernel version {} (os_type is "{}")'
+                          .format(cur_version, os_type))
     else:
         # version is sha1, need to try to extract sha1 from cur_version
         match = re.search('[-_]g([0-9a-f]{6,40})', cur_version)