Revision bb698c1f lib/utils.py
b/lib/utils.py | ||
---|---|---|
39 | 39 |
import select |
40 | 40 |
import fcntl |
41 | 41 |
import resource |
42 |
import logging |
|
42 | 43 |
|
43 | 44 |
from cStringIO import StringIO |
44 | 45 |
|
45 |
from ganeti import logger |
|
46 | 46 |
from ganeti import errors |
47 | 47 |
from ganeti import constants |
48 | 48 |
|
... | ... | |
88 | 88 |
else: |
89 | 89 |
self.fail_reason = "unable to determine termination reason" |
90 | 90 |
|
91 |
if debug and self.failed:
|
|
92 |
logger.Debug("Command '%s' failed (%s); output: %s" %
|
|
93 |
(self.cmd, self.fail_reason, self.output))
|
|
91 |
if self.failed: |
|
92 |
logging.debug("Command '%s' failed (%s); output: %s",
|
|
93 |
self.cmd, self.fail_reason, self.output)
|
|
94 | 94 |
|
95 | 95 |
def _GetOutput(self): |
96 | 96 |
"""Returns the combined stdout and stderr for easier usage. |
... | ... | |
123 | 123 |
else: |
124 | 124 |
strcmd = cmd |
125 | 125 |
shell = True |
126 |
logging.debug("RunCmd '%s'", strcmd) |
|
126 | 127 |
env = os.environ.copy() |
127 | 128 |
env["LC_ALL"] = "C" |
128 | 129 |
poller = select.poll() |
... | ... | |
258 | 259 |
target[k] = template[k] |
259 | 260 |
|
260 | 261 |
if missing and logname: |
261 |
logger.Debug('%s missing keys %s' % |
|
262 |
(logname, ', '.join(missing))) |
|
262 |
logging.warning('%s missing keys %s', logname, ', '.join(missing)) |
|
263 | 263 |
|
264 | 264 |
|
265 | 265 |
def IsProcessAlive(pid): |
... | ... | |
386 | 386 |
name, size = line.split() |
387 | 387 |
size = int(float(size)) |
388 | 388 |
except (IndexError, ValueError), err: |
389 |
logger.Error("Invalid output from vgs (%s): %s" % (err, line))
|
|
389 |
logging.error("Invalid output from vgs (%s): %s", err, line)
|
|
390 | 390 |
continue |
391 | 391 |
|
392 | 392 |
retval[name] = size |
Also available in: Unified diff