From: Andrew Schoen Date: Fri, 19 Dec 2014 16:58:18 +0000 (-0600) Subject: Allow os_version and os_type to be None when locking bare metal nodes. X-Git-Tag: 1.1.0~1056^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=02b7d28a5eb7e797ed9e39019a2cf03a51712761;p=teuthology.git Allow os_version and os_type to be None when locking bare metal nodes. 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 --- diff --git a/teuthology/lock.py b/teuthology/lock.py index 4291682384..3ded5af846 100644 --- a/teuthology/lock.py +++ b/teuthology/lock.py @@ -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) diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index 430b5fed10..6a6a0803cc 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -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'