Revision 7b3a8fb5

b/lib/bootstrap.py
241 241

  
242 242
def InitConfig(version, cluster_config, master_node_config,
243 243
               cfg_file=constants.CLUSTER_CONF_FILE):
244
    """Create the initial cluster configuration.
245

  
246
    It will contain the current node, which will also be the master
247
    node, and no instances.
248

  
249
    @type version: int
250
    @param version: Configuration version
251
    @type cluster_config: objects.Cluster
252
    @param cluster_config: Cluster configuration
253
    @type master_node_config: objects.Node
254
    @param master_node_config: Master node configuration
255
    @type file_name: string
256
    @param file_name: Configuration file path
257

  
258
    @rtype: ssconf.SimpleConfigWriter
259
    @returns: Initialized config instance
260

  
261
    """
262
    nodes = {
263
      master_node_config.name: master_node_config,
264
      }
265

  
266
    config_data = objects.ConfigData(version=version,
267
                                     cluster=cluster_config,
268
                                     nodes=nodes,
269
                                     instances={},
270
                                     serial_no=1)
271
    cfg = ssconf.SimpleConfigWriter.FromDict(config_data.ToDict(), cfg_file)
272
    cfg.Save()
273

  
274
    return cfg
244
  """Create the initial cluster configuration.
245

  
246
  It will contain the current node, which will also be the master
247
  node, and no instances.
248

  
249
  @type version: int
250
  @param version: Configuration version
251
  @type cluster_config: objects.Cluster
252
  @param cluster_config: Cluster configuration
253
  @type master_node_config: objects.Node
254
  @param master_node_config: Master node configuration
255
  @type file_name: string
256
  @param file_name: Configuration file path
257

  
258
  @rtype: ssconf.SimpleConfigWriter
259
  @returns: Initialized config instance
260

  
261
  """
262
  nodes = {
263
    master_node_config.name: master_node_config,
264
    }
265

  
266
  config_data = objects.ConfigData(version=version,
267
                                   cluster=cluster_config,
268
                                   nodes=nodes,
269
                                   instances={},
270
                                   serial_no=1)
271
  cfg = ssconf.SimpleConfigWriter.FromDict(config_data.ToDict(), cfg_file)
272
  cfg.Save()
273

  
274
  return cfg
275 275

  
276 276

  
277 277
def FinalizeClusterDestroy(master):
b/lib/cmdlib.py
1465 1465
      nodenames = self.wanted
1466 1466
      missing = set(nodenames).difference(all_info.keys())
1467 1467
      if missing:
1468
        raise self.OpExecError(
1468
        raise errors.OpExecError(
1469 1469
          "Some nodes were removed before retrieving their data: %s" % missing)
1470 1470
    else:
1471 1471
      nodenames = all_info.keys()
......
2649 2649
      instance_names = self.wanted
2650 2650
      missing = set(instance_names).difference(all_info.keys())
2651 2651
      if missing:
2652
        raise self.OpExecError(
2652
        raise errors.OpExecError(
2653 2653
          "Some instances were removed before retrieving their data: %s"
2654 2654
          % missing)
2655 2655
    else:
......
3397 3397
    if self.op.ip_check:
3398 3398
      if utils.TcpPing(self.check_ip, constants.DEFAULT_NODED_PORT):
3399 3399
        raise errors.OpPrereqError("IP %s of instance %s already in use" %
3400
                                   (self.check_ip, instance_name))
3400
                                   (self.check_ip, self.op.instance_name))
3401 3401

  
3402 3402
    # bridge verification
3403 3403
    bridge = getattr(self.op, "bridge", None)

Also available in: Unified diff