'Reboot the remote host.
Args:
timeout - How long to wait for the reboot.
label - The label we should boot into.  If None, we will
boot into the default kernel.  If it\'s LAST_BOOT_TAG,
we\'ll boot into whichever kernel was .boot\'ed last
(or the default kernel if we haven\'t .boot\'ed in this
job).  If it\'s None, we\'ll boot into the default kernel.
If it\'s something else, we\'ll boot into that.
wait - Should we wait to see if the machine comes back up.
fastsync - Don\'t wait for the sync to complete, just start one
and move on. This is for cases where rebooting prompty
is more important than data integrity and/or the
machine may have disks that cause sync to never return.
reboot_cmd - Reboot command to execute.'

def reboot(self, timeout=DEFAULT_REBOOT_TIMEOUT, label=LAST_BOOT_TAG, kernel_args=None, wait=True, fastsync=False, reboot_cmd=None, **dargs):

    if self.job:
        if (label == self.LAST_BOOT_TAG):
            label = self.job.last_boot_tag
        else:
            self.job.last_boot_tag = label
    self.reboot_setup(label=label, kernel_args=kernel_args, **dargs)
    if (label or kernel_args):
        if (not label):
            label = self.bootloader.get_default_title()
        self.bootloader.boot_once(label)
        if kernel_args:
            self.bootloader.add_args(label, kernel_args)
    print 'Reboot:    initiating    reboot'
    def reboot():
        self.record('GOOD', None, 'reboot.start')
        try:
            current_boot_id = self.get_boot_id()
            if (not fastsync):
                self.run('sync;    sync', timeout=timeout, ignore_status=True)
            if reboot_cmd:
                self.run(reboot_cmd)
            else:
                self.run('((    sync    &    sleep    5;    reboot    &    sleep    60;    reboot    -f    &    sleep    10;    reboot    -nf    &    sleep    10;    telinit    6    &)    </dev/null    >/dev/null    2>&1    &)')
        except error.AutoservRunError:
            self.record('ABORT', None, 'reboot.start', 'reboot    command    failed')
            raise
        if wait:
            self.wait_for_restart(timeout, old_boot_id=current_boot_id, **dargs)
    if wait:
        self.log_reboot(reboot)
    else:
        reboot()
