Commit c67bb898 authored by Marc Vef's avatar Marc Vef
Browse files

Reverted previous commit. Adding flexible RPC connection suffixes.

parent e3b52640
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -5,13 +5,13 @@
// To enabled logging with info level
#define LOG_INFO
//#define LOG_DEBUG
#define LOG_TRACE
//#define LOG_TRACE
#define LOG_DAEMON_PATH "/tmp/adafs_daemon.log"

// Enable logging for daemon
#define LOG_PRELOAD_INFO
//#define LOG_PRELOAD_DEBUG
#define LOG_PRELOAD_TRACE
//#define LOG_PRELOAD_TRACE
#define LOG_PRELOAD_PATH "/tmp/adafs_preload.log"

// If ACM time should be considered
@@ -40,6 +40,8 @@
#define RPCPORT 4433
#define RPC_TRIES 3
#define RPC_TIMEOUT 150000
// Set a hostname suffix when a connection is built. E.g., "-ib" to use Infiniband
#define HOSTNAME_SUFFIX ""
//#define MARGODIAG // enables diagnostics of margo (printed after shutting down

// Debug configurations
+5 −12
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ int getProcIdByName(string procName) {
 * @return
 */
bool get_addr_by_hostid(const uint64_t hostid, hg_addr_t& svr_addr) {
    string rpcprotocol(RPC_PROTOCOL);

    if (rpc_address_cache.tryGet(hostid, svr_addr)) {
        ld_logger->trace("tryGet successful and put in svr_addr");
        //found
@@ -228,17 +228,10 @@ bool get_addr_by_hostid(const uint64_t hostid, hg_addr_t& svr_addr) {
    } else {
        ld_logger->trace("not found in lrucache");
        // not found, manual lookup and add address mapping to LRU cache
        if (rpcprotocol.find("verbs") != std::string::npos){
            auto hostname = RPC_PROTOCOL + "://"s + fs_config->hosts.at(hostid) + "-ib:"s +
                            fs_config->rpc_port; // convert hostid to hostname and port
            ld_logger->trace("generated hostname {} with rpc_port {}", hostname, fs_config->rpc_port);
            margo_addr_lookup(ld_margo_rpc_id, hostname.c_str(), &svr_addr);
        }
        else {auto hostname = RPC_PROTOCOL + "://"s + fs_config->hosts.at(hostid) + ":"s +
        auto hostname = RPC_PROTOCOL + "://"s + fs_config->hosts.at(hostid) + HOSTNAME_SUFFIX + ":"s +
                        fs_config->rpc_port; // convert hostid to hostname and port
        ld_logger->trace("generated hostname {} with rpc_port {}", hostname, fs_config->rpc_port);
        margo_addr_lookup(ld_margo_rpc_id, hostname.c_str(), &svr_addr);
        }
        if (svr_addr == HG_ADDR_NULL)
            return false;
        rpc_address_cache.insert(hostid, svr_addr);