from teuthology import misc as teuthology
from teuthology import contextutil, packaging
from teuthology.parallel import parallel
-from teuthology.orchestra import run
from teuthology.task import ansible
from distutils.version import LooseVersion
)
-def purge_data(ctx):
- """
- Purge /var/lib/ceph on every remote in ctx.
-
- :param ctx: the argparse.Namespace object
- """
- with parallel() as p:
- for remote in ctx.cluster.remotes.iterkeys():
- p.spawn(_purge_data, remote)
-
-
-def _purge_data(remote):
- """
- Purge /var/lib/ceph on remote.
-
- :param remote: the teuthology.orchestra.remote.Remote object
- """
- log.info('Purging /var/lib/ceph on %s', remote)
- remote.run(args=[
- 'sudo',
- 'rm', '-rf', '--one-file-system', '--', '/var/lib/ceph',
- run.Raw('||'),
- 'true',
- run.Raw(';'),
- 'test', '-d', '/var/lib/ceph',
- run.Raw('&&'),
- 'sudo',
- 'find', '/var/lib/ceph',
- '-mindepth', '1',
- '-maxdepth', '2',
- '-type', 'd',
- '-exec', 'umount', '{}', ';',
- run.Raw(';'),
- 'sudo', 'umount', '/var/lib/ceph',
- run.Raw('||'),
- 'true',
- run.Raw(';'),
- 'sudo',
- 'rm', '-rf', '--one-file-system', '--', '/var/lib/ceph',
- ])
-
def install_packages(ctx, pkgs, config):
"""
Installs packages on each remote in ctx.
finally:
remove_packages(ctx, config, package_list)
remove_sources(ctx, config)
- if config.get('project', 'ceph') == 'ceph':
- purge_data(ctx)
def upgrade_old_style(ctx, node, remote, pkgs, system_type):
def _remove_sources_list(ctx, config, remote):
"""
- Removes /etc/yum.repos.d/{proj}.repo, /var/lib/{proj}, and /var/log/{proj}
+ Removes /etc/yum.repos.d/{proj}.repo
:param remote: the teuthology.orchestra.remote.Remote object
:param proj: the project whose .repo needs removing
"""
builder = _get_builder_project(ctx, remote, config)
builder.remove_repo()
- proj = builder.project
- # FIXME
- # There probably should be a way of removing these files that is
- # implemented in the yum/rpm remove procedures for the ceph package.
- # FIXME but why is this function doing these things?
- remote.run(
- args=['sudo', 'rm', '-r', '/var/lib/{proj}'.format(proj=proj)],
- check_status=False,
- )
- remote.run(
- args=['sudo', 'rm', '-r', '/var/log/{proj}'.format(proj=proj)],
- check_status=False,
- )
if remote.os.name not in ['opensuse', 'sle']:
_yum_unset_check_obsoletes(remote)