From: Sage Weil Date: Mon, 16 Jul 2012 17:53:25 +0000 (-0700) Subject: set machine description to ctx.archive when auto-locking machines for a run X-Git-Tag: 1.1.0~2496 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ff0f4742fef20ad180d1872fcea53d69a4b2285f;p=teuthology.git set machine description to ctx.archive when auto-locking machines for a run --- diff --git a/teuthology/lock.py b/teuthology/lock.py index 9b2145291e..e9f8312718 100644 --- a/teuthology/lock.py +++ b/teuthology/lock.py @@ -24,7 +24,7 @@ def send_request(method, url, body=None, headers=None): method, url, body, resp.status) return (False, None, resp.status) -def lock_many(ctx, num, user=None): +def lock_many(ctx, num, user=None, description=None): if user is None: user = teuthology.get_user() success, content, status = send_request('POST', _lock_url(ctx), @@ -32,6 +32,10 @@ def lock_many(ctx, num, user=None): if success: machines = json.loads(content) log.debug('locked {machines}'.format(machines=', '.join(machines.keys()))) + if description is not None: + log.debug('Setting locked machine descriptions to %s', description) + for m in machines.keys(): + update_lock(ctx, m, description) return machines if status == 503: log.error('Insufficient nodes available to lock %d nodes.', num) diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index 3ff0a20063..e4d3611b13 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -74,7 +74,7 @@ def lock_machines(ctx, config): else: assert 0, 'not enough machines free' - newly_locked = lock.lock_many(ctx, config, ctx.owner) + newly_locked = lock.lock_many(ctx, config, ctx.owner, ctx.archive) if len(newly_locked) == config: ctx.config['targets'] = newly_locked log.info('\n '.join(['Locked targets:', ] + yaml.safe_dump(ctx.config['targets'], default_flow_style=False).splitlines()))