1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#!/usr/bin/python
#
# Copyright 2007 Google Inc. Released under the GPL v2
"""
This module defines the base classes for the Host hierarchy.
Implementation details:
You should import the "hosts" package instead of importing each type of host.
Host: a machine on which you can run programs
RemoteHost: a remote machine on which you can run programs
"""
__author__ = """
mbligh@google.com (Martin J. Bligh),
poirier@google.com (Benjamin Poirier),
stutsman@google.com (Ryan Stutsman)
"""
import time
from autotest_lib.client.common_lib import global_config
from autotest_lib.server import utils
import bootloader
class Host(object):
"""
This class represents a machine on which you can run programs.
It may be a local machine, the one autoserv is running on, a remote
machine or a virtual machine.
Implementation details:
This is an abstract class, leaf subclasses must implement the methods
listed here. You must not instantiate this class but should
instantiate one of those leaf subclasses.
"""
bootloader = None
def __init__(self):
super(Host, self).__init__()
self.serverdir = utils.get_server_dir()
self.bootloader= bootloader.Bootloader(self)
self.env = {}
def run(self, command):
pass
def reboot(self):
pass
def reboot_setup(self):
pass
def reboot_followup(self):
pass
def get_file(self, source, dest):
pass
def send_file(self, source, dest):
pass
def get_tmp_dir(self):
pass
def is_up(self):
pass
def get_wait_up_processes(self):
"""
Gets the list of local processes to wait for in wait_up.
"""
get_config = global_config.global_config.get_config_value
proc_list = get_config("HOSTS", "wait_up_processes",
default="").strip()
processes = set(p.strip() for p in proc_list.split(","))
processes.discard("")
return processes
def wait_up(self, timeout):
pass
def wait_down(self, timeout):
pass
def get_num_cpu(self):
pass
def machine_install(self):
raise NotImplementedError('Machine install not implemented!')
def install(self, installableObject):
installableObject.install(self)
def get_crashdumps(self, test_start_time):
pass
def get_autodir(self):
return None
|