Revision 02f99608 lib/bootstrap.py

b/lib/bootstrap.py
229 229
  master_node_config = objects.Node(name=hostname.name,
230 230
                                    primary_ip=hostname.ip,
231 231
                                    secondary_ip=secondary_ip)
232
  cfg = config.ConfigWriter()
233
  cfg.InitConfig(constants.CONFIG_VERSION, cluster_config, master_node_config)
234 232

  
233
  cfg = InitConfig(constants.CONFIG_VERSION,
234
                   cluster_config, master_node_config)
235 235
  ssh.WriteKnownHostsFile(cfg, constants.SSH_KNOWN_HOSTS_FILE)
236 236

  
237 237
  # start the master ip
......
239 239
  rpc.call_node_start_master(hostname.name, True)
240 240

  
241 241

  
242
def InitConfig(version, cluster_config, master_node_config,
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
275

  
276

  
242 277
def FinalizeClusterDestroy(master):
243 278
  """Execute the last steps of cluster destroy
244 279

  

Also available in: Unified diff