Esempio n. 1
0
def generate_scaling_params(overcloud_roles):
    """Given a dictionary containing a key value mapping of Overcloud Role name
    to a count of the nodes return the scaling parameters to be used by
    tripleo_heat_merge

    :param overcloud_roles: Dictionary with role names and a count of the nodes
    :type  overcloud_roles: dict

    :return: scaling parameters dict
    :rtype:  dict
    """

    # Default values, merge.py needs also the 0 counts.
    scaling_defaults = ['NovaCompute=0', 'SwiftStorage=0', 'BlockStorage=0']

    scaling = merge.parse_scaling(scaling_defaults)

    for overcloud_role, count in overcloud_roles.items():
        overcloud_role = overcloud_role.lower()
        if overcloud_role in ROLES:
            scale_str = "%s=%s" % (
                        ROLES[overcloud_role]['template_param'], count)
            scaling.update(merge.parse_scaling([scale_str]))

    return scaling
Esempio n. 2
0
def generate_scaling_params(overcloud_roles):
    """Given a dictionary containing a key value mapping of Overcloud Role name
    to a count of the nodes return the scaling parameters to be used by
    tripleo_heat_merge

    :param overcloud_roles: Dictionary with role names and a count of the nodes
    :type  overcloud_roles: dict

    :return: scaling parameters dict
    :rtype:  dict
    """

    scaling = {}

    for overcloud_role, count in overcloud_roles.items():
        overcloud_role = overcloud_role.lower()

        if overcloud_role == OVERCLOUD_COMPUTE_ROLE:
            scaling = dict(scaling.items() + merge.parse_scaling(["NovaCompute=%s" % (count)]).items())

    return scaling