Revision 5fcdc80d
b/lib/cmdlib.py | ||
---|---|---|
539 | 539 |
ss.SetKey(ss.SS_MASTER_NODE, hostname['hostname_full']) |
540 | 540 |
ss.SetKey(ss.SS_MASTER_IP, clustername['ip']) |
541 | 541 |
ss.SetKey(ss.SS_MASTER_NETDEV, self.op.master_netdev) |
542 |
ss.SetKey(ss.SS_CLUSTER_NAME, clustername['hostname']) |
|
542 | 543 |
|
543 | 544 |
# set up the inter-node password and certificate |
544 | 545 |
_InitGanetiServerSetup(ss) |
... | ... | |
568 | 569 |
# init of cluster config file |
569 | 570 |
cfgw = config.ConfigWriter() |
570 | 571 |
cfgw.InitConfig(hostname['hostname'], hostname['ip'], self.secondary_ip, |
571 |
clustername['hostname'], sshkey, self.op.mac_prefix,
|
|
572 |
sshkey, self.op.mac_prefix, |
|
572 | 573 |
self.op.vg_name, self.op.def_bridge) |
573 | 574 |
|
574 | 575 |
|
... | ... | |
1481 | 1482 |
instances = [self.cfg.GetInstanceInfo(name) |
1482 | 1483 |
for name in self.cfg.GetInstanceList()] |
1483 | 1484 |
result = { |
1484 |
"name": self.cfg.GetClusterName(),
|
|
1485 |
"name": self.sstore.GetClusterName(),
|
|
1485 | 1486 |
"software_version": constants.RELEASE_VERSION, |
1486 | 1487 |
"protocol_version": constants.PROTOCOL_VERSION, |
1487 | 1488 |
"config_version": constants.CONFIG_VERSION, |
b/lib/config.py | ||
---|---|---|
483 | 483 |
self._DistributeConfig() |
484 | 484 |
|
485 | 485 |
def InitConfig(self, node, primary_ip, secondary_ip, |
486 |
clustername, hostkeypub, mac_prefix, vg_name, def_bridge):
|
|
486 |
hostkeypub, mac_prefix, vg_name, def_bridge): |
|
487 | 487 |
"""Create the initial cluster configuration. |
488 | 488 |
|
489 | 489 |
It will contain the current node, which will also be the master |
... | ... | |
493 | 493 |
node: the nodename of the initial node |
494 | 494 |
primary_ip: the IP address of the current host |
495 | 495 |
secondary_ip: the secondary IP of the current host or None |
496 |
clustername: the name of the cluster |
|
497 | 496 |
hostkeypub: the public hostkey of this host |
498 | 497 |
|
499 | 498 |
""" |
500 | 499 |
hu_port = constants.FIRST_DRBD_PORT - 1 |
501 | 500 |
globalconfig = objects.Cluster(config_version=constants.CONFIG_VERSION, |
502 | 501 |
serial_no=1, |
503 |
name=clustername, |
|
504 | 502 |
rsahostkeypub=hostkeypub, |
505 | 503 |
highest_used_port=hu_port, |
506 | 504 |
mac_prefix=mac_prefix, |
... | ... | |
517 | 515 |
cluster=globalconfig) |
518 | 516 |
self._WriteConfig() |
519 | 517 |
|
520 |
def GetClusterName(self): |
|
521 |
"""Return the cluster name. |
|
522 |
|
|
523 |
""" |
|
524 |
self._OpenConfig() |
|
525 |
self._ReleaseLock() |
|
526 |
return self._config_data.cluster.name |
|
527 |
|
|
528 | 518 |
def GetVGName(self): |
529 | 519 |
"""Return the volume group name. |
530 | 520 |
|
b/lib/mcpu.py | ||
---|---|---|
201 | 201 |
for key in lu_env: |
202 | 202 |
env["GANETI_" + key] = lu_env[key] |
203 | 203 |
|
204 |
if self.cfg is not None: |
|
205 |
env["GANETI_CLUSTER"] = self.cfg.GetClusterName() |
|
206 | 204 |
if self.sstore is not None: |
205 |
env["GANETI_CLUSTER"] = self.sstore.GetClusterName() |
|
207 | 206 |
env["GANETI_MASTER"] = self.sstore.GetMasterNode() |
208 | 207 |
|
209 | 208 |
for key in env: |
b/lib/objects.py | ||
---|---|---|
342 | 342 |
__slots__ = [ |
343 | 343 |
"config_version", |
344 | 344 |
"serial_no", |
345 |
"name", |
|
346 | 345 |
"rsahostkeypub", |
347 | 346 |
"highest_used_port", |
348 | 347 |
"tcpudp_port_pool", |
b/lib/ssconf.py | ||
---|---|---|
60 | 60 |
SS_MASTER_NODE = "master_node" |
61 | 61 |
SS_MASTER_IP = "master_ip" |
62 | 62 |
SS_MASTER_NETDEV = "master_netdev" |
63 |
SS_CLUSTER_NAME = "cluster_name" |
|
63 | 64 |
_VALID_KEYS = (SS_HYPERVISOR, SS_NODED_PASS, SS_MASTER_NODE, SS_MASTER_IP, |
64 |
SS_MASTER_NETDEV) |
|
65 |
SS_MASTER_NETDEV, SS_CLUSTER_NAME)
|
|
65 | 66 |
_MAX_SIZE = 4096 |
66 | 67 |
|
67 | 68 |
def __init__(self, cfg_location=None): |
... | ... | |
150 | 151 |
""" |
151 | 152 |
return self._ReadFile(self.SS_MASTER_NETDEV) |
152 | 153 |
|
154 |
def GetClusterName(self): |
|
155 |
"""Get the cluster name. |
|
156 |
|
|
157 |
""" |
|
158 |
return self._ReadFile(self.SS_CLUSTER_NAME) |
|
159 |
|
|
153 | 160 |
def SetKey(self, key, value): |
154 | 161 |
"""Set the value of a key. |
155 | 162 |
|
b/testing/mocks.py | ||
---|---|---|
29 | 29 |
def IsCluster(self): |
30 | 30 |
return True |
31 | 31 |
|
32 |
def GetClusterName(self): |
|
33 |
return "test.cluster" |
|
34 |
|
|
35 | 32 |
def GetNodeList(self): |
36 | 33 |
return ["a", "b", "c"] |
37 | 34 |
|
... | ... | |
42 | 39 |
class FakeSStore: |
43 | 40 |
"""Fake simplestore object""" |
44 | 41 |
|
42 |
def GetClusterName(self): |
|
43 |
return "test.cluster" |
|
44 |
|
|
45 | 45 |
def GetMasterNode(self): |
46 | 46 |
return socket.gethostname() |
b/tools/cfgshell | ||
---|---|---|
63 | 63 |
|
64 | 64 |
""" |
65 | 65 |
cmd.Cmd.__init__(self) |
66 |
self.cfg = self.cluster_name = None
|
|
66 |
self.cfg = None |
|
67 | 67 |
self.parents = [] |
68 | 68 |
self.path = [] |
69 | 69 |
if cfg_file: |
... | ... | |
133 | 133 |
if self.cfg is None: |
134 | 134 |
self.prompt = "(#no config) " |
135 | 135 |
else: |
136 |
self.prompt = "(%s:/%s) " % (self.cluster_name, "/".join(self.path))
|
|
136 |
self.prompt = "(/%s) " % ("/".join(self.path),)
|
|
137 | 137 |
return stop |
138 | 138 |
|
139 | 139 |
def do_load(self, line): |
... | ... | |
155 | 155 |
self.cfg._OpenConfig() |
156 | 156 |
self.parents = [self.cfg._config_data] |
157 | 157 |
self.path = [] |
158 |
self.cluster_name = self.cfg.GetClusterName() |
|
159 | 158 |
except errors.ConfigurationError, err: |
160 | 159 |
print "Error: %s" % str(err) |
161 | 160 |
return False |
Also available in: Unified diff