Add an option to not wait for sync before rebooting.
Signed-off-by: Josh Gilkerson <jwg@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2834 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/hosts/remote.py b/server/hosts/remote.py
index 6d05c07..b0fb8bc 100644
--- a/server/hosts/remote.py
+++ b/server/hosts/remote.py
@@ -77,7 +77,7 @@
def reboot(self, timeout=DEFAULT_REBOOT_TIMEOUT, label=LAST_BOOT_TAG,
- kernel_args=None, wait=True, **dargs):
+ kernel_args=None, wait=True, fastsync=False, **dargs):
"""
Reboot the remote host.
@@ -90,6 +90,10 @@
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.
"""
if self.job:
if label == self.LAST_BOOT_TAG:
@@ -115,15 +119,17 @@
try:
# sync before starting the reboot, so that a long sync during
# shutdown isn't timed out by wait_down's short timeout
- self.run('sync; sync', timeout=timeout, ignore_status=True)
+ if not fastsync:
+ self.run('sync; sync', timeout=timeout, ignore_status=True)
# Try several methods of rebooting in increasing harshness.
- self.run('('
+ self.run('(('
+ ' sync &'
' sleep 5; reboot &'
' sleep 60; reboot -f &'
' sleep 10; reboot -nf &'
' sleep 10; telinit 6 &'
- ') </dev/null >/dev/null 2>&1 &')
+ ') </dev/null >/dev/null 2>&1 &)')
except error.AutoservRunError:
self.record("ABORT", None, "reboot.start",
"reboot command failed")