def nuke_helper(ctx, should_unlock, keep_logs, should_reboot): # ensure node is up with ipmi (target,) = ctx.config['targets'].keys() host = target.split('@')[-1] shortname = host.split('.')[0] if should_unlock: if is_vm(shortname): return log.debug('shortname: %s' % shortname) if ctx.check_locks: # does not check to ensure if the node is 'up' # we want to be able to nuke a downed node check_lock.check_lock(ctx, None, check_up=False) status = get_status(host) if status['machine_type'] in provision.fog.get_types(): remote = Remote(host) remote.console.power_off() return elif status['machine_type'] in provision.pelagos.get_types(): provision.pelagos.park_node(host) return if (not ctx.noipmi and 'ipmi_user' in config and 'vpm' not in shortname): try: check_console(host) except Exception: log.exception('') log.info("Will attempt to connect via SSH") remote = Remote(host) remote.connect() add_remotes(ctx, None) connect(ctx, None) clear_firewall(ctx) shutdown_daemons(ctx) kill_valgrind(ctx) # Try to remove packages before reboot remove_installed_packages(ctx) remotes = ctx.cluster.remotes.keys() if should_reboot: reboot(ctx, remotes) # shutdown daemons again incase of startup shutdown_daemons(ctx) remove_osd_mounts(ctx) remove_osd_tmpfs(ctx) kill_hadoop(ctx) remove_ceph_packages(ctx) synch_clocks(remotes) unlock_firmware_repo(ctx) remove_configuration_files(ctx) undo_multipath(ctx) reset_syslog_dir(ctx) remove_ceph_data(ctx) if not keep_logs: remove_testing_tree(ctx) remove_yum_timedhosts(ctx) # Once again remove packages after reboot remove_installed_packages(ctx) log.info('Installed packages removed.')
def transfer_archives(run_name, job_id, archive_base, job_config): serializer = report.ResultsSerializer(archive_base) job_info = serializer.job_info(run_name, job_id, simple=True) if 'archive' in job_info: ctx = create_fake_context(job_config) add_remotes(ctx, job_config) for log_type, log_path in job_info['archive'].items(): if log_type == 'init': log_type = '' compress_logs(ctx, log_path) archive_logs(ctx, log_path, log_type) else: log.info('No archives to transfer.')