Revision 30786fc9
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
96 | 96 |
dirs = [(dname, constants.RUN_DIRS_MODE) for dname in self._DIRS] |
97 | 97 |
utils.EnsureDirs(dirs) |
98 | 98 |
|
99 |
def _InstancePidFile(self, instance_name): |
|
99 |
@classmethod |
|
100 |
def _InstancePidFile(cls, instance_name): |
|
100 | 101 |
"""Returns the instance pidfile. |
101 | 102 |
|
102 | 103 |
""" |
103 |
pidfile = "%s/%s" % (self._PIDS_DIR, instance_name) |
|
104 |
return pidfile |
|
104 |
return utils.PathJoin(cls._PIDS_DIR, instance_name) |
|
105 | 105 |
|
106 | 106 |
def _InstancePidAlive(self, instance_name): |
107 | 107 |
"""Returns the instance pid and pidfile |
... | ... | |
127 | 127 |
"""Returns the instance monitor socket name |
128 | 128 |
|
129 | 129 |
""" |
130 |
return '%s/%s.monitor' % (cls._CTRL_DIR, instance_name)
|
|
130 |
return utils.PathJoin(cls._CTRL_DIR, "%s.monitor" % instance_name)
|
|
131 | 131 |
|
132 | 132 |
@classmethod |
133 | 133 |
def _InstanceSerial(cls, instance_name): |
134 | 134 |
"""Returns the instance serial socket name |
135 | 135 |
|
136 | 136 |
""" |
137 |
return '%s/%s.serial' % (cls._CTRL_DIR, instance_name)
|
|
137 |
return utils.PathJoin(cls._CTRL_DIR, "%s.serial" % instance_name)
|
|
138 | 138 |
|
139 | 139 |
@staticmethod |
140 | 140 |
def _SocatUnixConsoleParams(): |
... | ... | |
153 | 153 |
"""Returns the instance KVM runtime filename |
154 | 154 |
|
155 | 155 |
""" |
156 |
return '%s/%s.runtime' % (cls._CONF_DIR, instance_name)
|
|
156 |
return utils.PathJoin(cls._CONF_DIR, "%s.runtime" % instance_name)
|
|
157 | 157 |
|
158 | 158 |
@classmethod |
159 | 159 |
def _RemoveInstanceRuntimeFiles(cls, pidfile, instance_name): |
... | ... | |
246 | 246 |
""" |
247 | 247 |
result = [] |
248 | 248 |
for name in os.listdir(self._PIDS_DIR): |
249 |
filename = "%s/%s" % (self._PIDS_DIR, name)
|
|
249 |
filename = utils.PathJoin(self._PIDS_DIR, name)
|
|
250 | 250 |
if utils.IsProcessAlive(utils.ReadPidFile(filename)): |
251 | 251 |
result.append(name) |
252 | 252 |
return result |
... | ... | |
263 | 263 |
if not alive: |
264 | 264 |
return None |
265 | 265 |
|
266 |
cmdline_file = "/proc/%s/cmdline" % pid
|
|
266 |
cmdline_file = utils.PathJoin("/proc", str(pid), "cmdline")
|
|
267 | 267 |
try: |
268 | 268 |
cmdline = utils.ReadFile(cmdline_file) |
269 | 269 |
except EnvironmentError, err: |
... | ... | |
293 | 293 |
""" |
294 | 294 |
data = [] |
295 | 295 |
for name in os.listdir(self._PIDS_DIR): |
296 |
filename = "%s/%s" % (self._PIDS_DIR, name)
|
|
296 |
filename = utils.PathJoin(self._PIDS_DIR, name)
|
|
297 | 297 |
if utils.IsProcessAlive(utils.ReadPidFile(filename)): |
298 | 298 |
try: |
299 | 299 |
info = self.GetInstanceInfo(name) |
Also available in: Unified diff