Revision 4a8b186a
b/lib/config.py | ||
---|---|---|
472 | 472 |
del self._temporary_drbds[key] |
473 | 473 |
|
474 | 474 |
@locking.ssynchronized(_config_lock, shared=1) |
475 |
def GetConfigVersion(self): |
|
476 |
"""Get the configuration version. |
|
477 |
|
|
478 |
@return: Config version |
|
479 |
|
|
480 |
""" |
|
481 |
return self._config_data.version |
|
482 |
|
|
483 |
@locking.ssynchronized(_config_lock, shared=1) |
|
484 |
def GetClusterName(self): |
|
485 |
"""Get cluster name. |
|
486 |
|
|
487 |
@return: Cluster name |
|
488 |
|
|
489 |
""" |
|
490 |
self._OpenConfig() |
|
491 |
return self._config_data.cluster.cluster_name |
|
492 |
|
|
493 |
@locking.ssynchronized(_config_lock, shared=1) |
|
494 |
def GetMasterNode(self): |
|
495 |
"""Get the hostname of the master node for this cluster. |
|
496 |
|
|
497 |
@return: Master hostname |
|
498 |
|
|
499 |
""" |
|
500 |
self._OpenConfig() |
|
501 |
return self._config_data.cluster.master_node |
|
502 |
|
|
503 |
@locking.ssynchronized(_config_lock, shared=1) |
|
504 |
def GetMasterIP(self): |
|
505 |
"""Get the IP of the master node for this cluster. |
|
506 |
|
|
507 |
@return: Master IP |
|
508 |
|
|
509 |
""" |
|
510 |
self._OpenConfig() |
|
511 |
return self._config_data.cluster.master_ip |
|
512 |
|
|
513 |
@locking.ssynchronized(_config_lock, shared=1) |
|
514 |
def GetMasterNetdev(self): |
|
515 |
"""Get the master network device for this cluster. |
|
516 |
|
|
517 |
""" |
|
518 |
self._OpenConfig() |
|
519 |
return self._config_data.cluster.master_netdev |
|
520 |
|
|
521 |
@locking.ssynchronized(_config_lock, shared=1) |
|
522 |
def GetFileStorageDir(self): |
|
523 |
"""Get the file storage dir for this cluster. |
|
524 |
|
|
525 |
""" |
|
526 |
self._OpenConfig() |
|
527 |
return self._config_data.cluster.file_storage_dir |
|
528 |
|
|
529 |
@locking.ssynchronized(_config_lock, shared=1) |
|
530 |
def GetHypervisorType(self): |
|
531 |
"""Get the hypervisor type for this cluster. |
|
532 |
|
|
533 |
""" |
|
534 |
self._OpenConfig() |
|
535 |
return self._config_data.cluster.hypervisor |
|
536 |
|
|
537 |
@locking.ssynchronized(_config_lock, shared=1) |
|
475 | 538 |
def GetHostKey(self): |
476 | 539 |
"""Return the rsa hostkey from the config. |
477 | 540 |
|
b/lib/constants.py | ||
---|---|---|
92 | 92 |
SSL_CERT_FILE = DATA_DIR + "/server.pem" |
93 | 93 |
WATCHER_STATEFILE = DATA_DIR + "/watcher.data" |
94 | 94 |
SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts" |
95 |
CLUSTER_PASSWORD_FILE = DATA_DIR + "/ssconf_node_pass" |
|
95 | 96 |
QUEUE_DIR = DATA_DIR + "/queue" |
96 | 97 |
ETC_HOSTS = "/etc/hosts" |
97 | 98 |
DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR |
b/lib/utils.py | ||
---|---|---|
1231 | 1231 |
return float(seconds) + (float(microseconds) * 0.000001) |
1232 | 1232 |
|
1233 | 1233 |
|
1234 |
def GetNodeDaemonPort(): |
|
1235 |
"""Get the node daemon port for this cluster. |
|
1236 |
|
|
1237 |
Note that this routine does not read a ganeti-specific file, but |
|
1238 |
instead uses socket.getservbyname to allow pre-customization of |
|
1239 |
this parameter outside of Ganeti. |
|
1240 |
|
|
1241 |
""" |
|
1242 |
try: |
|
1243 |
port = socket.getservbyname("ganeti-noded", "tcp") |
|
1244 |
except socket.error: |
|
1245 |
port = constants.DEFAULT_NODED_PORT |
|
1246 |
|
|
1247 |
return port |
|
1248 |
|
|
1249 |
|
|
1250 |
def GetNodeDaemonPassword(): |
|
1251 |
"""Get the node password for the cluster. |
|
1252 |
|
|
1253 |
""" |
|
1254 |
return ReadFile(constants.CLUSTER_PASSWORD_FILE) |
|
1255 |
|
|
1256 |
|
|
1234 | 1257 |
def LockedMethod(fn): |
1235 | 1258 |
"""Synchronized object access decorator. |
1236 | 1259 |
|
Also available in: Unified diff