Revision 4b63dc7a

b/daemons/ganeti-masterd
499 499
                          (constants.MASTERD_USER, constants.DAEMONS_GROUP))
500 500
    sys.exit(constants.EXIT_FAILURE)
501 501

  
502
  # Check the configuration is sane before anything else
503
  try:
504
    config.ConfigWriter()
505
  except errors.ConfigVersionMismatch, err:
506
    v1 = "%s.%s.%s" % constants.SplitVersion(err.args[0])
507
    v2 = "%s.%s.%s" % constants.SplitVersion(err.args[1])
508
    print >> sys.stderr,  \
509
        ("Configuration version mismatch. The current Ganeti software"
510
         " expects version %s, but the on-disk configuration file has"
511
         " version %s. This is likely the result of upgrading the"
512
         " software without running the upgrade procedure. Please contact"
513
         " your cluster administrator or complete the upgrade using the"
514
         " cfgupgrade utility, after reading the upgrade notes." %
515
         (v1, v2))
516
    sys.exit(constants.EXIT_FAILURE)
517
  except errors.ConfigurationError, err:
518
    print >> sys.stderr, \
519
        ("Configuration error while opening the configuration file: %s\n"
520
         "This might be caused by an incomplete software upgrade or"
521
         " by a corrupted configuration file. Until the problem is fixed"
522
         " the master daemon cannot start." % str(err))
523
    sys.exit(constants.EXIT_FAILURE)
502 524

  
503 525
  # If CheckMaster didn't fail we believe we are the master, but we have to
504 526
  # confirm with the other nodes.
b/lib/config.py
67 67

  
68 68
  """
69 69
  if data.version != constants.CONFIG_VERSION:
70
    raise errors.ConfigurationError("Cluster configuration version"
71
                                    " mismatch, got %s instead of %s" %
72
                                    (data.version,
73
                                     constants.CONFIG_VERSION))
70
    raise errors.ConfigVersionMismatch(constants.CONFIG_VERSION, data.version)
74 71

  
75 72

  
76 73
class TemporaryReservationManager:
b/lib/errors.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2006, 2007, 2010 Google Inc.
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
110 110
  pass
111 111

  
112 112

  
113
class ConfigVersionMismatch(ConfigurationError):
114
  """Version mismatch in the configuration file.
115

  
116
  The error has two arguments: the expected and the actual found
117
  version.
118

  
119
  """
120
  pass
121

  
122

  
113 123
class ReservationError(GenericError):
114 124
  """Errors reserving a resource.
115 125

  

Also available in: Unified diff