ceph/teuthology/lockstatus.py
Warren Usui a4994e3bde Support added for running scheduled tasks on virtual machines.
This included:
    A). changes made so that full path names on some files were used
        (scheduled tasks started in different home directories).
    B.) Changes to insure tasks come up on the beanstalkc queue properly,
    C.) Finding and inserting the libvirt eqivalent code for vm machines
        in order to simulate ipmi actions,
    D.) Fix host key code, report valgrind issue more clearly.
    E.) Some message and downburst call changes.

    Fix #4988
    Fix #5122
    Signed-off-by: Warren Usui <warren.usui@inktank.com>
2013-06-07 19:32:15 -07:00

27 lines
836 B
Python

import json
import httplib2
import logging
log = logging.getLogger(__name__)
def _lock_url(ctx):
try:
return ctx.teuthology_config['lock_server']
except (AttributeError, KeyError):
return "http://teuthology.front.sepia.ceph.com/locker/lock"
def send_request(method, url, body=None, headers=None):
http = httplib2.Http()
resp, content = http.request(url, method=method, body=body, headers=headers)
if resp.status == 200:
return (True, content, resp.status)
log.info("%s request to '%s' with body '%s' failed with response code %d",
method, url, body, resp.status)
return (False, None, resp.status)
def get_status(ctx, name):
success, content, _ = send_request('GET', _lock_url(ctx) + '/' + name)
if success:
return json.loads(content)
return None