Commit a33848a5 authored by Guido Trotter's avatar Guido Trotter
Browse files

Simplify InitConfig and remove SimpleConfigWriter

InitConfig currently creates the cluster config_data, then puts it into
a dict, passes it to SimpleConfigWriter to load it from a dict (which
just reuses the dict value) and then saves it. The SimpleConfigWriter is
then returned, but ignored. With this patch we just write out the
config_data at InitConfig time, and thus can remove SimpleConfigWriter
altogether. The now unused SimpleConfigReader.FromDict is also gone.
Signed-off-by: default avatarGuido Trotter <>
Reviewed-by: default avatarIustin Pop <>
parent 9e1333b9
......@@ -37,6 +37,7 @@ from ganeti import config
from ganeti import constants
from ganeti import objects
from ganeti import ssconf
from ganeti import serializer
from ganeti import hypervisor
......@@ -292,9 +293,6 @@ def InitConfig(version, cluster_config, master_node_config,
@type cfg_file: string
@param cfg_file: configuration file path
@rtype: L{ssconf.SimpleConfigWriter}
@return: initialized config instance
nodes = { master_node_config,
......@@ -305,10 +303,9 @@ def InitConfig(version, cluster_config, master_node_config,
cfg = ssconf.SimpleConfigWriter.FromDict(config_data.ToDict(), cfg_file)
return cfg
def FinalizeClusterDestroy(master):
......@@ -79,32 +79,6 @@ class SimpleConfigReader(object):
def GetNodeList(self):
return self._config_data["nodes"].keys()
def FromDict(cls, val, cfg_file=constants.CLUSTER_CONF_FILE):
"""Alternative construction from a dictionary.
obj = SimpleConfigReader.__new__(cls)
obj._config_data = val
obj._file_name = cfg_file
return obj
class SimpleConfigWriter(SimpleConfigReader):
"""Simple class to write configuration file.
def Save(self):
"""Writes configuration file.
Warning: Doesn't take care of locking or synchronizing with other
class SimpleStore(object):
"""Interface to static cluster data.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment