Adding a flag to allow halting before powercycling.
Signed-off-by: Fa Yoeu <[email protected]>
--- autotest/server/hosts/remote.py 2010-07-20 16:06:08.000000000 -0700
+++ autotest/server/hosts/remote.py 2010-07-20 16:06:08.000000000 -0700
@@ -25,6 +25,7 @@
DEFAULT_REBOOT_TIMEOUT = base_classes.Host.DEFAULT_REBOOT_TIMEOUT
LAST_BOOT_TAG = object()
+ DEFAULT_HALT_TIMEOUT = 2 * 60
VAR_LOG_MESSAGES_COPY_PATH = "/var/log/messages.autotest_start"
@@ -88,6 +89,12 @@
self.run('echo b > /proc/sysrq-trigger &')
+ def halt(self, timeout=DEFAULT_HALT_TIMEOUT, wait=True):
+ self.run('/sbin/halt')
+ if wait:
+ self.wait_down(timeout=timeout)
+
+
def reboot(self, timeout=DEFAULT_REBOOT_TIMEOUT, label=LAST_BOOT_TAG,
kernel_args=None, wait=True, fastsync=False,
reboot_cmd=None, **dargs):
--- autotest/server/hosts/serial.py 2010-07-20 16:06:08.000000000 -0700
+++ autotest/server/hosts/serial.py 2010-07-20 16:06:08.000000000 -0700
@@ -114,7 +114,7 @@
def hardreset(self, timeout=DEFAULT_REBOOT_TIMEOUT, wait=True,
- conmux_command='hardreset', num_attempts=1,
+ conmux_command='hardreset', num_attempts=1, halt=False,
**wait_for_restart_kwargs):
"""
Reach out and slap the box in the power switch.
@@ -124,6 +124,7 @@
@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()
"""
@@ -138,6 +139,8 @@
old_boot_id = 'unknown boot_id prior to SerialHost.hardreset'
def reboot():
+ if halt:
+ self.halt()
if not self.run_conmux(conmux_command):
self.record("ABORT", None, "reboot.start",
"hard reset unavailable")
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest