Revision b9eeeb02 lib/config.py
b/lib/config.py | ||
---|---|---|
861 | 861 |
self._DistributeConfig() |
862 | 862 |
|
863 | 863 |
@locking.ssynchronized(_config_lock) |
864 |
def InitConfig(self, node, primary_ip, secondary_ip, |
|
865 |
hostkeypub, mac_prefix, vg_name, def_bridge): |
|
864 |
def InitConfig(self, cluster_config, master_node_config): |
|
866 | 865 |
"""Create the initial cluster configuration. |
867 | 866 |
|
868 | 867 |
It will contain the current node, which will also be the master |
869 |
node, and no instances or operating systmes.
|
|
868 |
node, and no instances. |
|
870 | 869 |
|
871 |
Args: |
|
872 |
node: the nodename of the initial node |
|
873 |
primary_ip: the IP address of the current host |
|
874 |
secondary_ip: the secondary IP of the current host or None |
|
875 |
hostkeypub: the public hostkey of this host |
|
876 |
|
|
877 |
""" |
|
878 |
hu_port = constants.FIRST_DRBD_PORT - 1 |
|
879 |
globalconfig = objects.Cluster(serial_no=1, |
|
880 |
rsahostkeypub=hostkeypub, |
|
881 |
highest_used_port=hu_port, |
|
882 |
mac_prefix=mac_prefix, |
|
883 |
volume_group_name=vg_name, |
|
884 |
default_bridge=def_bridge, |
|
885 |
tcpudp_port_pool=set()) |
|
886 |
if secondary_ip is None: |
|
887 |
secondary_ip = primary_ip |
|
888 |
nodeconfig = objects.Node(name=node, primary_ip=primary_ip, |
|
889 |
secondary_ip=secondary_ip, serial_no=1) |
|
890 |
|
|
891 |
self._config_data = objects.ConfigData(nodes={node: nodeconfig}, |
|
870 |
@type cluster_config: objects.Cluster |
|
871 |
@param cluster_config: Cluster configuration |
|
872 |
@type master_node_config: objects.Node |
|
873 |
@param master_node_config: Master node configuration |
|
874 |
|
|
875 |
""" |
|
876 |
nodes = { |
|
877 |
master_node_config.name: master_node_config, |
|
878 |
} |
|
879 |
|
|
880 |
self._config_data = objects.ConfigData(cluster=cluster_config, |
|
881 |
nodes=nodes, |
|
892 | 882 |
instances={}, |
893 |
cluster=globalconfig, |
|
894 | 883 |
serial_no=1) |
895 | 884 |
self._WriteConfig() |
896 | 885 |
|
Also available in: Unified diff