Commit 1059337d authored by Helga Velroyen's avatar Helga Velroyen
Browse files

Store candidate certificates in ssconf



This patch enables Ganeti to store the candidate
certificate map in ssconf. A utility function to
read it is provided as well.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent 840ad2ab
...@@ -2593,6 +2593,10 @@ class ConfigWriter(object): ...@@ -2593,6 +2593,10 @@ class ConfigWriter(object):
cluster = self._config_data.cluster cluster = self._config_data.cluster
cluster_tags = fn(cluster.GetTags()) cluster_tags = fn(cluster.GetTags())
master_candidates_certs = fn("%s=%s" % (mc_uuid, mc_cert)
for mc_uuid, mc_cert
in cluster.candidate_certs.items())
hypervisor_list = fn(cluster.enabled_hypervisors) hypervisor_list = fn(cluster.enabled_hypervisors)
all_hvparams = self._GetAllHvparamsStrings(constants.HYPER_TYPES) all_hvparams = self._GetAllHvparamsStrings(constants.HYPER_TYPES)
...@@ -2613,6 +2617,7 @@ class ConfigWriter(object): ...@@ -2613,6 +2617,7 @@ class ConfigWriter(object):
constants.SS_GLUSTER_STORAGE_DIR: cluster.gluster_storage_dir, constants.SS_GLUSTER_STORAGE_DIR: cluster.gluster_storage_dir,
constants.SS_MASTER_CANDIDATES: mc_data, constants.SS_MASTER_CANDIDATES: mc_data,
constants.SS_MASTER_CANDIDATES_IPS: mc_ips_data, constants.SS_MASTER_CANDIDATES_IPS: mc_ips_data,
constants.SS_MASTER_CANDIDATES_CERTS: master_candidates_certs,
constants.SS_MASTER_IP: cluster.master_ip, constants.SS_MASTER_IP: cluster.master_ip,
constants.SS_MASTER_NETDEV: cluster.master_netdev, constants.SS_MASTER_NETDEV: cluster.master_netdev,
constants.SS_MASTER_NETMASK: str(cluster.master_netmask), constants.SS_MASTER_NETMASK: str(cluster.master_netmask),
......
...@@ -49,6 +49,7 @@ _VALID_KEYS = compat.UniqueFrozenset([ ...@@ -49,6 +49,7 @@ _VALID_KEYS = compat.UniqueFrozenset([
constants.SS_GLUSTER_STORAGE_DIR, constants.SS_GLUSTER_STORAGE_DIR,
constants.SS_MASTER_CANDIDATES, constants.SS_MASTER_CANDIDATES,
constants.SS_MASTER_CANDIDATES_IPS, constants.SS_MASTER_CANDIDATES_IPS,
constants.SS_MASTER_CANDIDATES_CERTS,
constants.SS_MASTER_IP, constants.SS_MASTER_IP,
constants.SS_MASTER_NETDEV, constants.SS_MASTER_NETDEV,
constants.SS_MASTER_NETMASK, constants.SS_MASTER_NETMASK,
...@@ -243,6 +244,22 @@ class SimpleStore(object): ...@@ -243,6 +244,22 @@ class SimpleStore(object):
nl = data.splitlines(False) nl = data.splitlines(False)
return nl return nl
def GetMasterCandidatesCertMap(self):
"""Returns the map of master candidate UUIDs to ssl cert.
@rtype: dict of string to string
@return: dictionary mapping the master candidates' UUIDs
to their SSL certificate digests
"""
data = self._ReadFile(constants.SS_MASTER_CANDIDATES_CERTS)
lines = data.splitlines(False)
certs = {}
for line in lines:
(node_uuid, cert_digest) = line.split("=")
certs[node_uuid] = cert_digest
return certs
def GetMasterIP(self): def GetMasterIP(self):
"""Get the IP of the master node for this cluster. """Get the IP of the master node for this cluster.
......
...@@ -3502,6 +3502,9 @@ ssMasterCandidates = "master_candidates" ...@@ -3502,6 +3502,9 @@ ssMasterCandidates = "master_candidates"
ssMasterCandidatesIps :: String ssMasterCandidatesIps :: String
ssMasterCandidatesIps = "master_candidates_ips" ssMasterCandidatesIps = "master_candidates_ips"
ssMasterCandidatesCerts :: String
ssMasterCandidatesCerts = "master_candidates_certs"
ssMasterIp :: String ssMasterIp :: String
ssMasterIp = "master_ip" ssMasterIp = "master_ip"
......
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