Revision 89e1fc26 daemons/ganeti-watcher
b/daemons/ganeti-watcher | ||
---|---|---|
39 | 39 |
import time |
40 | 40 |
import fcntl |
41 | 41 |
import errno |
42 |
import socket |
|
43 | 42 |
from optparse import OptionParser |
44 | 43 |
|
45 | 44 |
|
46 | 45 |
from ganeti import utils |
47 | 46 |
from ganeti import constants |
48 | 47 |
from ganeti import ssconf |
48 |
from ganeti import errors |
|
49 | 49 |
|
50 | 50 |
|
51 | 51 |
class Error(Exception): |
... | ... | |
263 | 263 |
def __init__(self): |
264 | 264 |
sstore = ssconf.SimpleStore() |
265 | 265 |
master = sstore.GetMasterNode() |
266 |
if master != socket.gethostname():
|
|
266 |
if master != utils.HostInfo().name:
|
|
267 | 267 |
raise NotMasterError("This is not the master node") |
268 | 268 |
self.instances = InstanceList() |
269 | 269 |
self.messages = [] |
... | ... | |
357 | 357 |
if options.debug: |
358 | 358 |
sys.stderr.write("Not master, exiting.\n") |
359 | 359 |
sys.exit(constants.EXIT_NOTMASTER) |
360 |
except errors.ResolverError, err: |
|
361 |
sys.stderr.write("Cannot resolve hostname '%s', exiting.\n" % err.args[0]) |
|
362 |
sys.exit(constants.EXIT_NODESETUP_ERROR) |
|
360 | 363 |
except Error, err: |
361 | 364 |
print err |
362 | 365 |
|
Also available in: Unified diff