Example #1
0
 def test_get_ceph_vol(self):
     """
     Ensures the Ceph Volume settings are properly parsed
     """
     ceph_vol = config_utils.get_ceph_vol(self.config)
     expected = self.persis_vol[consts.CEPH_VOLUME_KEY]
     self.assertEqual(expected, ceph_vol)
def validate_nodetype_data(config):
    """
    Checks the presence of nodetype datatype
    """
    logger.info("checking nodetype_data")
    ceph_vol_hosts = config_utils.get_ceph_vol(config)
    for ceph_vol_host in ceph_vol_hosts:
        host_conf = ceph_vol_host[consts.HOST_KEY]
        validate_dict_data(host_conf, consts.NODE_TYPE_KEY)
        node_type = host_conf[consts.NODE_TYPE_KEY]

        if (node_type != consts.CEPH_CTRL_TYPE
                and node_type != consts.CEPH_OSD_TYPE):
            raise ValidationException('Ceph node type is not {} or {}'.format(
                consts.CEPH_CTRL_TYPE, consts.CEPH_OSD_TYPE))
def validate_ceph_osd_params(config):
    """
    Checks the presence of Ceph osd parameters foe secondary storage presence
    """
    logger.info("checking ceph_osd_params")
    ceph_hosts = config_utils.get_ceph_vol(config)

    for ceph_host in ceph_hosts:
        ceph_host_data = ceph_host[consts.HOST_KEY]
        if ceph_host_data[consts.NODE_TYPE_KEY] == consts.CEPH_OSD_TYPE:
            if (consts.CEPH_CLAIMS_KEY not in ceph_host_data
                    and consts.STORAGE_TYPE_KEY in ceph_host_data):
                return
            else:
                raise ValidationException(
                    "for ceph_osd only secondary storage should be present")
def validate_ceph_vol_params(config):
    """
    Checks the presence of Ceph Volume parameters
    """
    logger.info("checking ceph_vol_params")

    ceph_vols = config_utils.get_ceph_vol(config)

    for ceph_vol in ceph_vols:
        validate_dict_data(ceph_vol, consts.HOST_KEY)

        ceph_host = ceph_vol[consts.HOST_KEY]
        validate_dict_data(ceph_host, consts.IP_KEY)
        validate_dict_data(ceph_host, consts.NODE_TYPE_KEY)
        validate_dict_data(ceph_host, consts.PASSWORD_KEY)
        validate_dict_data(ceph_host, consts.USER_KEY)
def validate_ceph_controller_params(config):
    """
    Checks the presence of Ceph Controller parameters for ceph claim
    """
    logger.info("checking ceph_controller_params")
    ceph_hosts = config_utils.get_ceph_vol(config)
    for ceph_host in ceph_hosts:
        ceph_host_data = ceph_host[consts.HOST_KEY]
        if ceph_host_data[consts.NODE_TYPE_KEY] == consts.CEPH_CTRL_TYPE:
            validate_dict_data(ceph_host_data, consts.CEPH_CLAIMS_KEY)
            claims = ceph_host_data[consts.CEPH_CLAIMS_KEY]
            for claim in claims:
                claim_params = claim[consts.CLAIM_PARAMS_KEY]
                validate_dict_data(claim_params, consts.CEPH_CLAIM_NAME_KEY)
                validate_dict_data(claim_params, consts.CEPH_STORAGE_KEY)
        else:
            validate_dict_data(ceph_host_data, consts.STORAGE_TYPE_KEY)
def validate_deployment_file(config):
    """
    Calls all the validations
    """
    logger.info("validate_deployment_file function")

    validate_kubernetes_tag(config)
    validate_kubernetes_params(config)
    validate_hostnames(config)
    validate_node_config_tag(config)
    validate_node_config_params(config)
    validate_count_master_minion(config)

    if consts.HA_CONFIG_KEY in config:
        validate_api_ext_loadbalancer_tag_params(config)

    validate_countmasters(config)

    if consts.ACCESS_SEC_KEY in config:
        validate_access_and_security_params(config)

    validate_docker_repo_tag(config)
    validate_docker_repo_params(config)

    validate_proxy_params(config)

    validate_network_tag(config)
    validate_default_network_params(config)

    validate_multus_network_cni(config)
    validate_multus_network_cni_conf(config)
    validate_cni_params(config)
    validate_duplicatein_cni_and_networkplugin(config)
    ismaster_count_for_deployment(config)

    if config_utils.get_ceph_vol(config):
        validate_nodetype_data(config)
        validate_ceph_vol_params(config)
        validate_ceph_controller_params(config)
        validate_ceph_osd_params(config)

    logger.info('Deployment file is valid')
def __create_ceph_host(k8s_conf):
    logger.info("Ceph host creation")
    ceph_hosts = config_utils.get_ceph_vol(k8s_conf)
    if ceph_hosts:
        aconf.launch_ceph_kubernetes(k8s_conf)