import argparse
+import logging
+import os
+import subprocess
+import time
import yaml
+from . import orchestra
+from .orchestra import run
+from .lock import list_locks
+from .lock import unlock_one
+from .misc import get_testdir
+from .misc import get_user
+from .misc import read_config
+from .misc import reconnect
+from .parallel import parallel
+from .run import config_file
+from .task import install as install_task
+from .task.internal import check_lock
+from .task.internal import connect
+
def shutdown_daemons(ctx, log):
- from .orchestra import run
nodes = {}
for remote in ctx.cluster.remotes.iterkeys():
proc = remote.run(
def find_kernel_mounts(ctx, log):
- from .orchestra import run
nodes = {}
log.info('Looking for kernel mounts to handle...')
for remote in ctx.cluster.remotes.iterkeys():
properly we should be able to just do a forced unmount,
but that doesn't seem to be working, so you should reboot instead
"""
- from .orchestra import run
nodes = {}
for remote in kernel_mounts:
log.info('clearing kernel mount from %s', remote.name)
"""
unmount any osd data mounts (scratch disks)
"""
- from .orchestra import run
ctx.cluster.run(
args=[
'grep',
"""
unmount tmpfs mounts
"""
- from .orchestra import run
ctx.cluster.run(
args=[
'egrep', 'tmpfs\s+/mnt', '/etc/mtab', run.Raw('|'),
def reboot(ctx, remotes, log):
- from .orchestra import run
- import time
nodes = {}
for remote in remotes:
log.info('rebooting %s', remote.name)
# send anything back to the ssh client!
# for remote, proc in nodes.iteritems():
# proc.exitstatus.get()
- from teuthology.misc import reconnect
if remotes:
log.info('waiting for nodes to reboot')
time.sleep(5) # if we try and reconnect too quickly, it succeeds!
def reset_syslog_dir(ctx, log):
- from .orchestra import run
nodes = {}
for remote in ctx.cluster.remotes.iterkeys():
proc = remote.run(
def dpkg_configure(ctx, log):
- from .orchestra import run
nodes = {}
for remote in ctx.cluster.remotes.iterkeys():
proc = remote.run(
def remove_installed_packages(ctx, log):
- from teuthology.task import install as install_task
dpkg_configure(ctx, log)
config = {'project': 'ceph'}
def remove_testing_tree(ctx, log):
- from teuthology.misc import get_testdir
- from .orchestra import run
nodes = {}
for remote in ctx.cluster.remotes.iterkeys():
proc = remote.run(
def synch_clocks(remotes, log):
- from .orchestra import run
nodes = {}
for remote in remotes:
proc = remote.run(
def main(ctx):
- from teuthology.run import config_file
- import os
-
- import logging
-
log = logging.getLogger(__name__)
loglevel = logging.INFO
if not ctx.owner:
ctx.owner = open(ctx.archive + '/owner').read().rstrip('\n')
- from teuthology.misc import read_config
read_config(ctx)
log.info(
default_flow_style=False).splitlines()))
if ctx.owner is None:
- from teuthology.misc import get_user
ctx.owner = get_user()
if ctx.pid:
ctx.pid,
ctx.pid))
else:
- import subprocess
subprocess.check_call(["kill", "-9", str(ctx.pid)])
nuke(ctx, log, ctx.unlock, ctx.synch_clocks, ctx.reboot_all, ctx.noipmi)
def nuke(ctx, log, should_unlock, sync_clocks=True, reboot_all=True,
noipmi=False):
- from teuthology.parallel import parallel
- from teuthology.lock import list_locks
total_unnuked = {}
targets = dict(ctx.config['targets'])
if ctx.name:
def nuke_one(ctx, targets, log, should_unlock, synch_clocks, reboot_all,
check_locks, noipmi):
- from teuthology.lock import unlock_one
ret = None
ctx = argparse.Namespace(
config=dict(targets=targets),
def nuke_helper(ctx, log):
# ensure node is up with ipmi
- from teuthology.orchestra import remote
(target,) = ctx.config['targets'].keys()
host = target.split('@')[-1]
log.debug('shortname: %s' % shortname)
log.debug('{ctx}'.format(ctx=ctx))
if not ctx.noipmi and 'ipmi_user' in ctx.teuthology_config:
- console = remote.getRemoteConsole(
+ console = orchestra.remote.getRemoteConsole(
name=host,
ipmiuser=ctx.teuthology_config['ipmi_user'],
ipmipass=ctx.teuthology_config['ipmi_password'],
else:
log.info('console ready on %s' % cname)
- from teuthology.task.internal import check_lock, connect
if ctx.check_locks:
check_lock(ctx, None)
connect(ctx, None)
import StringIO
import contextlib
import sys
+import logging
from traceback import format_tb
+from . import report
+from .misc import deep_merge
+from .misc import get_distro
+from .misc import get_user
+from .misc import read_config
+from .nuke import nuke
+from .run_tasks import run_tasks
+from .suite import email_results
+
+
def config_file(string):
config = {}
def __call__(self, parser, namespace, values, option_string=None):
config = getattr(namespace, self.dest)
- from teuthology.misc import deep_merge
for new in values:
deep_merge(config, new)
def set_up_logging(ctx):
- import logging
-
loglevel = logging.INFO
if ctx.verbose:
loglevel = logging.DEBUG
def install_except_hook():
def log_exception(exception_class, exception, traceback):
- import logging
-
logging.critical(''.join(format_tb(traceback)))
if not exception.message:
logging.critical(exception_class.__name__)
def main(ctx):
- import logging
set_up_logging(ctx)
log = logging.getLogger(__name__)
- from . import report
-
if ctx.owner is None:
- from teuthology.misc import get_user
ctx.owner = get_user()
# Older versions of teuthology stored job_id as an int. Convert it to a str
assert ctx.lock, \
'the --block option is only supported with the --lock option'
- from teuthology.misc import read_config
read_config(ctx)
log.debug('\n '.join(['Config:', ] + yaml.safe_dump(
{'internal.vm_setup': None},
])
if 'kernel' in ctx.config:
- from teuthology.misc import get_distro
distro = get_distro(ctx)
if distro == 'ubuntu':
init_tasks.append({'kernel': ctx.config['kernel']})
ctx.config['tasks'][:0] = init_tasks
- from teuthology.run_tasks import run_tasks
try:
run_tasks(tasks=ctx.config['tasks'], ctx=ctx)
finally:
if not ctx.summary.get('success') and ctx.config.get('nuke-on-error'):
- from teuthology.nuke import nuke
# only unlock if we locked them in the first place
nuke(ctx, log, ctx.lock)
if ctx.archive is not None:
emsg = f.getvalue()
subject = "Teuthology error -- %s" % ctx.summary[
'failure_reason']
- from teuthology.suite import email_results
email_results(subject, "Teuthology", ctx.config[
'email-on-error'], emsg)
log.info('pass')
else:
log.info('FAIL')
- import sys
sys.exit(1)