Revision c89189b1 daemons/ganeti-noded
b/daemons/ganeti-noded | ||
---|---|---|
30 | 30 |
import BaseHTTPServer |
31 | 31 |
import simplejson |
32 | 32 |
import errno |
33 |
import logging |
|
33 | 34 |
|
34 | 35 |
from optparse import OptionParser |
35 | 36 |
|
... | ... | |
42 | 43 |
from ganeti import ssconf |
43 | 44 |
from ganeti import utils |
44 | 45 |
|
46 |
_EXIT_GANETI_NODED = False |
|
47 |
|
|
45 | 48 |
|
46 | 49 |
class ServerObject(BaseHTTPServer.BaseHTTPRequestHandler): |
47 | 50 |
"""The server implementation. |
... | ... | |
56 | 59 |
path = self.path |
57 | 60 |
if path.startswith("/"): |
58 | 61 |
path = path[1:] |
62 |
logging.debug("ServerObject: received call '%s'", path) |
|
59 | 63 |
mname = "perspective_%s" % path |
60 | 64 |
if not hasattr(self, mname): |
61 | 65 |
self.send_error(404) |
... | ... | |
75 | 79 |
return |
76 | 80 |
try: |
77 | 81 |
params = simplejson.loads(body) |
82 |
logging.debug("ServerObject: method parameters: %s", params) |
|
78 | 83 |
result = method(params) |
79 | 84 |
payload = simplejson.dumps(result) |
80 | 85 |
except errors.QuitGanetiException, err: |
... | ... | |
107 | 112 |
(self.address_string(), |
108 | 113 |
self.log_date_time_string(), |
109 | 114 |
format % args)) |
110 |
logger.Debug(msg)
|
|
115 |
logging.debug(msg)
|
|
111 | 116 |
|
112 | 117 |
# the new block devices -------------------------- |
113 | 118 |
|
... | ... | |
628 | 633 |
if options.fork: |
629 | 634 |
utils.Daemonize(logfile=constants.LOG_NODESERVER) |
630 | 635 |
|
631 |
logger.SetupLogging(program="ganeti-noded", debug=options.debug) |
|
636 |
logger.SetupDaemon(logfile=constants.LOG_NODESERVER, debug=options.debug) |
|
637 |
logging.info("ganeti node daemon startup") |
|
632 | 638 |
|
633 | 639 |
global _EXIT_GANETI_NODED |
634 |
_EXIT_GANETI_NODED = False |
|
635 | 640 |
|
636 | 641 |
httpd = BaseHTTPServer.HTTPServer(('', port), ServerObject) |
637 | 642 |
while (not _EXIT_GANETI_NODED): |
Also available in: Unified diff