Revision dffa96d6 lib/ssconf.py

b/lib/ssconf.py
28 28

  
29 29
import sys
30 30
import errno
31
import logging
31 32

  
32 33
from ganeti import errors
33 34
from ganeti import constants
......
368 369
    if debug:
369 370
      sys.stderr.write("Not master, exiting.\n")
370 371
    sys.exit(constants.EXIT_NOTMASTER)
372

  
373

  
374
def VerifyClusterName(name, _cfg_location=None):
375
  """Verifies cluster name against a local cluster name.
376

  
377
  @type name: string
378
  @param name: Cluster name
379

  
380
  """
381
  sstore = SimpleStore(cfg_location=_cfg_location)
382

  
383
  try:
384
    local_name = sstore.GetClusterName()
385
  except errors.ConfigurationError, err:
386
    logging.debug("Can't get local cluster name: %s", err)
387
  else:
388
    if name != local_name:
389
      raise errors.GenericError("Current cluster name is '%s'" % local_name)

Also available in: Unified diff