Revision 5675cd1f daemons/ganeti-masterd
b/daemons/ganeti-masterd | ||
---|---|---|
265 | 265 |
object.__setattr__(self, name, value) |
266 | 266 |
|
267 | 267 |
|
268 |
def CheckMaster(debug): |
|
269 |
"""Checks the node setup. |
|
270 |
|
|
271 |
If this is the master, the function will return. Otherwise it will |
|
272 |
exit with an exit code based on the node status. |
|
273 |
|
|
274 |
""" |
|
275 |
try: |
|
276 |
ss = ssconf.SimpleStore() |
|
277 |
master_name = ss.GetMasterNode() |
|
278 |
except errors.ConfigurationError, err: |
|
279 |
print "Cluster configuration incomplete: '%s'" % str(err) |
|
280 |
sys.exit(EXIT_NODESETUP_ERROR) |
|
281 |
|
|
282 |
try: |
|
283 |
myself = utils.HostInfo() |
|
284 |
except errors.ResolverError, err: |
|
285 |
sys.stderr.write("Cannot resolve my own name (%s)\n" % err.args[0]) |
|
286 |
sys.exit(EXIT_NODESETUP_ERROR) |
|
287 |
|
|
288 |
if myself.name != master_name: |
|
289 |
if debug: |
|
290 |
sys.stderr.write("Not master, exiting.\n") |
|
291 |
sys.exit(EXIT_NOTMASTER) |
|
292 |
|
|
293 |
|
|
294 | 268 |
def ParseOptions(): |
295 | 269 |
"""Parse the command line options. |
296 | 270 |
|
... | ... | |
320 | 294 |
utils.debug = options.debug |
321 | 295 |
utils.no_fork = True |
322 | 296 |
|
323 |
CheckMaster(options.debug) |
|
297 |
ssconf.CheckMaster(options.debug)
|
|
324 | 298 |
|
325 | 299 |
master = IOServer(constants.MASTER_SOCKET, ClientRqHandler, GanetiContext()) |
326 | 300 |
|
Also available in: Unified diff