X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Ftools%2Fcephfs%2FRoleSelector.cc;fp=src%2Fceph%2Fsrc%2Ftools%2Fcephfs%2FRoleSelector.cc;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=3c7932a5eb9e6fa50f1b97d39411ed2cb3be182d;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/tools/cephfs/RoleSelector.cc b/src/ceph/src/tools/cephfs/RoleSelector.cc deleted file mode 100644 index 3c7932a..0000000 --- a/src/ceph/src/tools/cephfs/RoleSelector.cc +++ /dev/null @@ -1,58 +0,0 @@ - -#include "RoleSelector.h" - -int MDSRoleSelector::parse_rank( - const FSMap &fsmap, - std::string const &str) -{ - if (str == "all" || str == "*") { - std::set in; - const MDSMap &mds_map = fsmap.get_filesystem(fscid)->mds_map; - mds_map.get_mds_set(in); - - for (auto rank : in) { - roles.push_back(mds_role_t(fscid, rank)); - } - - return 0; - } else { - std::string rank_err; - mds_rank_t rank = strict_strtol(str.c_str(), 10, &rank_err); - if (!rank_err.empty()) { - return -EINVAL; - } - if (fsmap.get_filesystem(fscid)->mds_map.is_dne(rank)) { - return -ENOENT; - } - roles.push_back(mds_role_t(fscid, rank)); - return 0; - } -} - -int MDSRoleSelector::parse(const FSMap &fsmap, std::string const &str) -{ - auto colon_pos = str.find(":"); - if (colon_pos == std::string::npos) { - // An unqualified rank. Only valid if there is only one - // namespace. - if (fsmap.filesystem_count() == 1) { - fscid = fsmap.get_filesystem()->fscid; - return parse_rank(fsmap, str); - } else { - return -EINVAL; - } - } else if (colon_pos == 0 || colon_pos == str.size() - 1) { - return -EINVAL; - } else { - const std::string ns_str = str.substr(0, colon_pos); - const std::string rank_str = str.substr(colon_pos + 1); - std::shared_ptr fs_ptr; - int r = fsmap.parse_filesystem(ns_str, &fs_ptr); - if (r != 0) { - return r; - } - fscid = fs_ptr->fscid; - return parse_rank(fsmap, rank_str); - } -} -