示例#1
0
def ceph_health_check():
    """
    Check health of Ceph
    """
    pod = get_pod_with_labels('application=ceph,component=mon')

    cmd = ['ceph', 'health', '-f', 'json']
    response = kube_exec(pod, cmd)

    response = ast.literal_eval(response)

    result = {
        'category': 'storage',
        'case_name': 'ceph_health_check',
        'details': []
    }

    if response['status'] == 'HEALTH_OK':
        result['criteria'] = 'pass'
        result['details'] = 'HEALTH_OK'
    else:
        result['criteria'] = 'fail'
        result['details'] = response

    store_result(result)
    return result
示例#2
0
def trace_vswitch_dpdk_lcores():
    """
    Trace vswitch_dpdk_lcores from Airship deployment

    :return: value traced from `other_config:dpdk-lcore-mask` in
    openvswitchdb using ovs-vsctl
    """
    ovs_pod = get_pod_with_labels(
        'application=openvswitch,component=openvswitch-vswitchd')

    cmd = ['ovs-vsctl', '-t', '5', 'get', 'Open_vSwitch', '.', 'other_config']
    response = kube_exec(ovs_pod, cmd)

    # convert config str to json str
    match = re.findall("[a-zA-Z0-9-]+=", response)
    for key in match:
        response = response.replace(key, '"' + key[:-1] + '":')
    match = re.findall(":[a-zA-Z0-9-]+", response)
    for key in match:
        response = response.replace(key[1:], '"' + key[1:] + '"')

    config = json.loads(response)

    if 'dpdk-lcore-mask' in config:
        pmd_cores = hex_to_comma_list(config['dpdk-lcore-mask'])
    else:
        pmd_cores = ''

    return pmd_cores
示例#3
0
def neutron_ml2_config():
    """
    Returns parsed ml2 config from neutron
    """
    ovs = get_pod_with_labels(
        "application=neutron,component=neutron-ovs-agent")
    sriov = get_pod_with_labels(
        "application=neutron,component=neutron-sriov-agent")

    confs = get_neutron_ml2_conf_from_pod(ovs)
    confs.extend(get_neutron_ml2_conf_from_pod(sriov))

    config = configparser.ConfigParser()
    for conf in confs:
        config.read_string(conf)

    return config
示例#4
0
def get_nova_conf():
    """
    Returns parsed nova.conf
    """
    pod = get_pod_with_labels('application=nova,component=compute')

    cmd = ['cat', '/etc/nova/nova.conf']
    response = kube_exec(pod, cmd)

    config = configparser.ConfigParser()
    config.read_string(response)

    return config
示例#5
0
def trace_isolated_cores():
    """
    Trace isolated_cores from Airship deployment

    :return: value traced from `isolcpus` key in `/proc/cmdline`
    """
    pod = get_pod_with_labels('application=nova,component=compute')

    cmd = ['cat', '/proc/cmdline']
    proc_cmd = kube_exec(pod, cmd)

    for option in proc_cmd.split():
        if 'isolcpus' in option:
            _, isolcpus_value = split_key_value(option)
            break

    return isolcpus_value