Revision 7b3a8fb5 lib/bootstrap.py
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): |
Also available in: Unified diff