in katran/lib/KatranLb.cpp [235:290]
void KatranLb::initialSanityChecking(bool flowDebug, bool globalLru) {
int res;
std::vector<std::string> maps;
if (!config_.disableForwarding) {
maps.push_back("ctl_array");
maps.push_back("vip_map");
maps.push_back("ch_rings");
maps.push_back("reals");
maps.push_back("stats");
maps.push_back("lru_mapping");
maps.push_back("server_id_map");
if (flowDebug) {
maps.push_back(kFlowDebugParentMapName.data());
}
if (globalLru) {
maps.push_back(kGlobalLruMapName.data());
}
res = getKatranProgFd();
if (res < 0) {
throw std::invalid_argument(folly::sformat(
"can't get fd for prog: {}, error: {}",
kBalancerProgName,
folly::errnoStr(errno)));
}
}
if (config_.enableHc) {
res = getHealthcheckerProgFd();
if (res < 0) {
throw std::invalid_argument(folly::sformat(
"can't get fd for prog: {}, error: {}",
kHealthcheckerProgName,
folly::errnoStr(errno)));
}
maps.push_back("hc_ctrl_map");
maps.push_back("hc_reals_map");
maps.push_back("hc_stats_map");
}
// some sanity checking. we will check that all maps exists, so in later
// code we wouldn't check if their fd != -1
// names of the maps must be the same as in bpf code.
for (auto& map : maps) {
res = bpfAdapter_.getMapFdByName(map);
if (res < 0) {
VLOG(4) << "missing map: " << map;
throw std::invalid_argument(
folly::sformat("map not found, error: {}", folly::errnoStr(errno)));
}
}
}