Revision f6bd6e98

b/lib/bootstrap.py
230 230
    volume_group_name=vg_name,
231 231
    default_bridge=def_bridge,
232 232
    tcpudp_port_pool=set(),
233
    hypervisor=hypervisor_type,
234
    master_node=hostname.name,
235
    master_ip=clustername.ip,
236
    master_netdev=master_netdev,
237
    cluster_name=clustername.name,
238
    file_storage_dir=file_storage_dir,
233 239
    )
234 240
  master_node_config = objects.Node(name=hostname.name,
235 241
                                    primary_ip=hostname.ip,
236 242
                                    secondary_ip=secondary_ip)
237 243
  cfg = config.ConfigWriter()
238
  cfg.InitConfig(cluster_config, master_node_config)
244
  cfg.InitConfig(constants.CONFIG_VERSION, cluster_config, master_node_config)
239 245

  
240 246
  ssh.WriteKnownHostsFile(cfg, ss, constants.SSH_KNOWN_HOSTS_FILE)
241 247

  
b/lib/config.py
861 861
    self._DistributeConfig()
862 862

  
863 863
  @locking.ssynchronized(_config_lock)
864
  def InitConfig(self, cluster_config, master_node_config):
864
  def InitConfig(self, version, cluster_config, master_node_config):
865 865
    """Create the initial cluster configuration.
866 866

  
867 867
    It will contain the current node, which will also be the master
868 868
    node, and no instances.
869 869

  
870
    @type version: int
871
    @param version: Configuration version
870 872
    @type cluster_config: objects.Cluster
871 873
    @param cluster_config: Cluster configuration
872 874
    @type master_node_config: objects.Node
......
877 879
      master_node_config.name: master_node_config,
878 880
      }
879 881

  
880
    self._config_data = objects.ConfigData(cluster=cluster_config,
882
    self._config_data = objects.ConfigData(version=version,
883
                                           cluster=cluster_config,
881 884
                                           nodes=nodes,
882 885
                                           instances={},
883 886
                                           serial_no=1)
b/lib/objects.py
237 237

  
238 238
class ConfigData(ConfigObject):
239 239
  """Top-level config object."""
240
  __slots__ = ["cluster", "nodes", "instances", "serial_no"]
240
  __slots__ = ["version", "cluster", "nodes", "instances", "serial_no"]
241 241

  
242 242
  def ToDict(self):
243 243
    """Custom function for top-level config data.
......
695 695
    "mac_prefix",
696 696
    "volume_group_name",
697 697
    "default_bridge",
698
    "hypervisor",
699
    "master_node",
700
    "master_ip",
701
    "master_netdev",
702
    "cluster_name",
703
    "file_storage_dir",
698 704
    ]
699 705

  
700 706
  def ToDict(self):
b/test/ganeti.config_unittest.py
55 55

  
56 56
  def _init_cluster(self, cfg):
57 57
    """Initializes the cfg object"""
58
    me = utils.HostInfo()
59
    ip = constants.LOCALHOST_IP_ADDRESS
60

  
58 61
    cluster_config = objects.Cluster(
59 62
      serial_no=1,
60 63
      rsahostkeypub="",
......
63 66
      volume_group_name="xenvg",
64 67
      default_bridge=constants.DEFAULT_BRIDGE,
65 68
      tcpudp_port_pool=set(),
69
      hypervisor=constants.HT_FAKE,
70
      master_node=me.name,
71
      master_ip="127.0.0.1",
72
      master_netdev=constants.DEFAULT_BRIDGE,
73
      cluster_name="cluster.local",
74
      file_storage_dir="/tmp",
66 75
      )
67
    ip = constants.LOCALHOST_IP_ADDRESS
68
    master_node_config = objects.Node(name=utils.HostInfo().name,
69
                                      primary_ip=ip,
76

  
77
    master_node_config = objects.Node(name=me.name,
78
                                      primary_ip=me.ip,
70 79
                                      secondary_ip=ip)
71
    cfg.InitConfig(cluster_config, master_node_config)
80

  
81
    cfg.InitConfig(constants.CONFIG_VERSION,
82
                   cluster_config, master_node_config)
72 83

  
73 84
  def _create_instance(self):
74 85
    """Create and return an instance object"""

Also available in: Unified diff