Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(935)

Unified Diff: server/hosts/remote.py

Issue 3554003: Merge remote branch 'cros/upstream' into tempbranch3 (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « server/git_kernel.py ('k') | server/hosts/serial.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/hosts/remote.py
diff --git a/server/hosts/remote.py b/server/hosts/remote.py
index b692480c2976c61ebfd8d11cb9993e651166e23b..e46bc1b65479a1023c576db414b53222e72fc591 100644
--- a/server/hosts/remote.py
+++ b/server/hosts/remote.py
@@ -1,7 +1,7 @@
"""This class defines the Remote host class, mixing in the SiteHost class
if it is available."""
-import os, logging
+import os, logging, urllib
from autotest_lib.client.common_lib import error
from autotest_lib.server import utils
from autotest_lib.server.hosts import base_classes, bootloader
@@ -25,6 +25,7 @@ class RemoteHost(base_classes.Host):
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 @@ class RemoteHost(base_classes.Host):
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):
@@ -213,6 +220,21 @@ class RemoteHost(base_classes.Host):
return None
+ def get_all_labels(self):
+ """
+ Return all labels, or empty list if label is not set.
+ """
+ if self.job:
+ keyval_path = os.path.join(self.job.resultdir, 'host_keyvals',
+ self.hostname)
+ keyvals = utils.read_keyval(keyval_path)
+ all_labels = keyvals.get('labels', '')
+ if all_labels:
+ all_labels = all_labels.split(',')
+ return [urllib.unquote(label) for label in all_labels]
+ return []
+
+
def delete_tmp_dir(self, tmpdir):
"""
Delete the given temporary directory on the remote machine.
« no previous file with comments | « server/git_kernel.py ('k') | server/hosts/serial.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698