]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Allow os_version and os_type to be None when locking bare metal nodes.
authorAndrew Schoen <aschoen@redhat.com>
Fri, 19 Dec 2014 16:58:18 +0000 (10:58 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Fri, 19 Dec 2014 17:28:04 +0000 (11:28 -0600)
This fixes a bug that was defaulting os_version to 12.04 and os_type to
ubuntu when locking bare metal machines.  We don't want to default the
os_version or os_type when locking bare metal so that the locking code
can pick whichever node is available.

VPS nodes will get proper defaults in provision.create_if_vm if they
aren't explicitly defined by either the config yaml or the cli flags.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
teuthology/lock.py
teuthology/task/internal.py

index 42916823844f976480386b00053aa6fb4f5a4d16..3ded5af8462e7de6500cb012a6f1ff142a555647 100644 (file)
@@ -74,6 +74,10 @@ def vps_version_or_type_valid(machine_type, os_type, os_version):
     """
     if not machine_type == 'vps':
         return True
+    if os_type is None or os_version is None:
+        # we'll use the defaults provided by provision.create_if_vm
+        # later on during provisioning
+        return True
     valid_os_and_version = get_distro_from_downburst()
     if os_type not in valid_os_and_version:
         log.error("os-type '%s' is invalid", os_type)
index 430b5fed100b58fcbfab7ca4b824734a0db3c980..6a6a0803cc1d3755f52166f327299510fd0f0f75 100644 (file)
@@ -65,8 +65,12 @@ def lock_machines(ctx, config):
     new machines.  This is not called if the one has teuthology-locked
     machines and placed those keys in the Targets section of a yaml file.
     """
-    os_type = misc.get_distro(ctx)
-    os_version = misc.get_distro_version(ctx)
+    # It's OK for os_type and os_version to be None here.  If we're trying
+    # to lock a bare metal machine, we'll take whatever is available.  If
+    # we want a vps, defaults will be provided by misc.get_distro and
+    # misc.get_distro_version in provision.create_if_vm
+    os_type = ctx.config.get("os_type")
+    os_version = ctx.config.get("os_version")
     arch = ctx.config.get('arch')
     log.info('Locking machines...')
     assert isinstance(config[0], int), 'config[0] must be an integer'