'Reboot the machine using the install server.
:params timeout: timelimit in seconds before the machine is
considered unreachable
:params wait: Whether or not to wait for the machine to reboot
:params num_attempts: Number of times to attempt hard reset erroring
on the last attempt.
:params halt: Halts the machine before hardresetting.
:params **wait_for_restart_kwargs: keyword arguments passed to
wait_for_restart()'

def hardreset(self, timeout=DEFAULT_REBOOT_TIMEOUT, wait=True, num_attempts=1, halt=False, **wait_for_restart_kwargs):

    server_info = get_install_server_info()
    if (server_info.get('xmlrpc_url', None) is not None):
        ServerInterface = self.INSTALL_SERVER_MAPPING[server_info['type']]
        server_interface = ServerInterface(**server_info)
        try:
            old_boot_id = self.get_boot_id()
        except error.AutoservSSHTimeout:
            old_boot_id = 'unknown    boot_id    prior    to    RemoteHost.hardreset'
        def reboot():
            power_state = 'reboot'
            if halt:
                self.halt()
                power_state = 'on'
            server_interface.power_host(host=self, state=power_state)
            self.record('GOOD', None, 'reboot.start', 'hard    reset')
            if wait:
                warning_msg = 'Machine    failed    to    respond    to    hard    reset    attempt    (%s/%s)'
                for attempt in xrange((num_attempts - 1)):
                    try:
                        self.wait_for_restart(timeout, log_failure=False, old_boot_id=old_boot_id, **wait_for_restart_kwargs)
                    except error.AutoservShutdownError:
                        logging.warning(warning_msg, (attempt + 1), num_attempts)
                        server_interface.power_host(host=self, state=power_state)
                    else:
                        break
                else:
                    try:
                        self.wait_for_restart(timeout, old_boot_id=old_boot_id, **wait_for_restart_kwargs)
                    except error.AutoservShutdownError:
                        logging.warning(warning_msg, num_attempts, num_attempts)
                        msg = 'Host    did    not    shutdown'
                        raise error.AutoservShutdownError(msg)
        if self.job:
            self.job.disable_warnings('POWER_FAILURE')
        try:
            if wait:
                self.log_reboot(reboot)
            else:
                reboot()
        finally:
            if self.job:
                self.job.enable_warnings('POWER_FAILURE')
    else:
        raise error.AutoservUnsupportedError('Empty    install    server    setup    on    global_config.ini')
