#!/bin/bash

_install() {
    return 0
}

_check() {
    [[ -z $MachineType ]] && return 1
    _check="PASS"
    arch |grep -q 'x86_64' || return 0

    local cpu_nums numa_node numa_conf
    cpu_nums=$(cat /proc/cpuinfo |grep 'physical id'|awk '{print $NF}'|sort|uniq|wc -l)
    numa_node=$(lscpu |grep "NUMA node"|head -n 1|awk '{print $NF}')
    numa_conf=$(/usr/bin/python "$BASEDIR"/utils/GetApolloConf.py "machinetype_numa_number" "$MachineType")
    if [[ -n $numa_conf ]];then
        # numa_conf=2 or 8
        ((cpu_nums=cpu_nums*numa_conf/2))
    fi
    if [[ $numa_node -ne $cpu_nums ]];then
        _check="FAIL"
        PRINT_ERR "[ERROR] Numa Setting Not OK. cpu_nums: $cpu_nums. numa_node: $numa_node."
        return 1
    fi
}
