Revision eb180fe2

b/lib/bootstrap.py
605 605
  try:
606 606
    # instantiate a real config writer, as we now know we have the
607 607
    # configuration data
608
    cfg = config.ConfigWriter()
608
    cfg = config.ConfigWriter(accept_foreign=True)
609 609

  
610 610
    cluster_info = cfg.GetClusterInfo()
611 611
    cluster_info.master_node = new_master
b/lib/config.py
132 132
  @ivar _all_rms: a list of all temporary reservation managers
133 133

  
134 134
  """
135
  def __init__(self, cfg_file=None, offline=False, _getents=runtime.GetEnts):
135
  def __init__(self, cfg_file=None, offline=False, _getents=runtime.GetEnts,
136
               accept_foreign=False):
136 137
    self.write_count = 0
137 138
    self._lock = _config_lock
138 139
    self._config_data = None
......
156 157
    self._my_hostname = netutils.Hostname.GetSysName()
157 158
    self._last_cluster_serial = -1
158 159
    self._cfg_id = None
159
    self._OpenConfig()
160
    self._OpenConfig(accept_foreign)
160 161

  
161 162
  # this method needs to be static, so that we can call it on the class
162 163
  @staticmethod
......
1291 1292
            self._config_data.nodegroups.values() +
1292 1293
            [self._config_data.cluster])
1293 1294

  
1294
  def _OpenConfig(self):
1295
  def _OpenConfig(self, accept_foreign):
1295 1296
    """Read the config data from disk.
1296 1297

  
1297 1298
    """
......
1310 1311
      raise errors.ConfigurationError("Incomplete configuration"
1311 1312
                                      " (missing cluster.rsahostkeypub)")
1312 1313

  
1314
    if data.cluster.master_node != self._my_hostname and not accept_foreign:
1315
      msg = ("The configuration denotes node %s as master, while my"
1316
             " hostname is %s; opening a foreign configuration is only"
1317
             " possible in accept_foreign mode" %
1318
             (data.cluster.master_node, self._my_hostname))
1319
      raise errors.ConfigurationError(msg)
1320

  
1313 1321
    # Upgrade configuration if needed
1314 1322
    data.UpgradeConfig()
1315 1323

  

Also available in: Unified diff