Commit 3047ea07 authored by Ramon Nou's avatar Ramon Nou
Browse files

Merge branch 'rnou/350-move-options-to-hostfile-instead-of-initial-rpc' into 'master'

Resolve "Move options to hostfile instead of initial RPC"

Closes #350

Closes #350

See merge request !242
parents a0501fb4 de028734
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -95,3 +95,4 @@ builds/

# Allow users to provide their own CMake presets
CMakeUserPresets.json
gkfs/
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
  - Export extra user library functions ([!227](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/227))
  - Update CLI11 and fmt to avoid cmake errors ([!231])(https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/231))
  - Update CLI11 in modules ([!232](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/232)).
  - Faster initialization relaying on host_files information instead of server RPC ([!242](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/242))
  
### Fixed
  - Dup3 is supported if O_CLOEXEC is not used (i.e. hexdump) ([!228](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/228))
+8 −7
Original line number Diff line number Diff line
@@ -329,13 +329,14 @@ init_environment() {
        }
    }

    LOG(INFO, "Retrieving file system configuration...");

    if(!gkfs::rpc::forward_get_fs_config()) {
        exit_error_msg(
                EXIT_FAILURE,
                "Unable to fetch file system configurations from daemon process through RPC.");
    }
    //    LOG(INFO, "Retrieving file system configuration...");

    //   if(!gkfs::rpc::forward_get_fs_config()) {
    //       exit_error_msg(
    //               EXIT_FAILURE,
    //               "Unable to fetch file system configurations from daemon
    //               process through RPC.");
    //   }
    // Initialize random number generator and seed for replica selection
    // in case of failure, a new replica will be selected
    if(CTX->get_replicas() > 0) {
+21 −3
Original line number Diff line number Diff line
@@ -166,8 +166,10 @@ load_hostfile(const std::string& path) {
                                        path, strerror(errno)));
    }
    vector<pair<string, string>> hosts;
    const regex line_re("^(\\S+)\\s+(\\S+)\\s*(\\S*)$",
    const regex line_re(
            "^(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)$",
            regex::ECMAScript | regex::optimize);

    string line;
    string host;
    string uri;
@@ -185,9 +187,25 @@ load_hostfile(const std::string& path) {
            throw runtime_error(
                    fmt::format("unrecognized line format: '{}'", line));
        }

        host = match[1];
        uri = match[2];
        // match[3] that is the proxy (not used here)
        hosts.emplace_back(host, uri);

        // info will be repeated line per line:
        CTX->mountdir(match[4]);
        LOG(INFO, "Mountdir: '{}'", CTX->mountdir());

        CTX->fs_conf()->rootdir = match[5];
        CTX->fs_conf()->atime_state = match[6] == '1';
        CTX->fs_conf()->mtime_state = match[7] == '1';
        CTX->fs_conf()->ctime_state = match[8] == '1';
        CTX->fs_conf()->link_cnt_state = match[9] == '1';
        CTX->fs_conf()->blocks_state = match[10] == '1';
        // convert match[11] and match[12] to unsigned integers.
        CTX->fs_conf()->uid = std::stoi(match[11]);
        CTX->fs_conf()->gid = std::stoi(match[12]);
    }
    if(hosts.empty()) {
        throw runtime_error(
+4 −2
Original line number Diff line number Diff line
@@ -75,8 +75,10 @@ MalleableManager::load_hostfile(const std::string& path) {
                                        path, strerror(errno)));
    }
    vector<pair<string, string>> hosts;
    const regex line_re("^(\\S+)\\s+(\\S+)\\s*(\\S*)$",
    const regex line_re(
            "^(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)$",
            regex::ECMAScript | regex::optimize);

    string line;
    string host;
    string uri;
Loading