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 nuke_helper(ctx, should_unlock): # 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 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() 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) remove_testing_tree(ctx) remove_yum_timedhosts(ctx) # Once again remove packages after reboot remove_installed_packages(ctx) log.info('Installed packages removed.')
def __init__(self, name, os_type, os_version, status=None, user='******', logfile=None): self.name = name self.shortname = decanonicalize_hostname(self.name) self.os_type = os_type self.os_version = os_version self.status = status or query.get_status(self.name) self.config_path = None self.user_path = None self.user = user self.logfile = logfile self.host = decanonicalize_hostname(self.status['vm_host']['name']) self.executable = downburst_executable()