LGTM, thanks

On Thu, Dec 19, 2013 at 3:49 PM, Helga Velroyen <[email protected]> wrote:

> 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: Helga Velroyen <[email protected]>
> ---
>  lib/config.py           |  5 +++++
>  lib/ssconf.py           | 17 +++++++++++++++++
>  src/Ganeti/Constants.hs |  3 +++
>  3 files changed, 25 insertions(+)
>
> diff --git a/lib/config.py b/lib/config.py
> index 7dfd285..fcdefc3 100644
> --- a/lib/config.py
> +++ b/lib/config.py
> @@ -2593,6 +2593,10 @@ class ConfigWriter(object):
>      cluster = self._config_data.cluster
>      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)
>      all_hvparams = self._GetAllHvparamsStrings(constants.HYPER_TYPES)
>
> @@ -2613,6 +2617,7 @@ class ConfigWriter(object):
>        constants.SS_GLUSTER_STORAGE_DIR: cluster.gluster_storage_dir,
>        constants.SS_MASTER_CANDIDATES: mc_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_NETDEV: cluster.master_netdev,
>        constants.SS_MASTER_NETMASK: str(cluster.master_netmask),
> diff --git a/lib/ssconf.py b/lib/ssconf.py
> index 7cfbd1d..a2a660f 100644
> --- a/lib/ssconf.py
> +++ b/lib/ssconf.py
> @@ -49,6 +49,7 @@ _VALID_KEYS = compat.UniqueFrozenset([
>    constants.SS_GLUSTER_STORAGE_DIR,
>    constants.SS_MASTER_CANDIDATES,
>    constants.SS_MASTER_CANDIDATES_IPS,
> +  constants.SS_MASTER_CANDIDATES_CERTS,
>    constants.SS_MASTER_IP,
>    constants.SS_MASTER_NETDEV,
>    constants.SS_MASTER_NETMASK,
> @@ -243,6 +244,22 @@ class SimpleStore(object):
>      nl = data.splitlines(False)
>      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):
>      """Get the IP of the master node for this cluster.
>
> diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
> index 09ee7b8..c4ba9e2 100644
> --- a/src/Ganeti/Constants.hs
> +++ b/src/Ganeti/Constants.hs
> @@ -3502,6 +3502,9 @@ ssMasterCandidates = "master_candidates"
>  ssMasterCandidatesIps :: String
>  ssMasterCandidatesIps = "master_candidates_ips"
>
> +ssMasterCandidatesCerts :: String
> +ssMasterCandidatesCerts = "master_candidates_certs"
> +
>  ssMasterIp :: String
>  ssMasterIp = "master_ip"
>
> --
> 1.8.5.1
>
>

Reply via email to