X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Ftools%2Frbd%2Faction%2FKernel.cc;h=eb57bfa1f37eb37f59a876f1139e956dfc61b9dd;hb=f6b5b4d738b87d88d2de35127b6b0e41eae2a272;hp=3ebb5bc1de40b4e3bdae235640b81f607efc59f8;hpb=12732ca2e80d168d344a265acffc1fbd1fa1f1b5;p=ceph.git diff --git a/ceph/src/tools/rbd/action/Kernel.cc b/ceph/src/tools/rbd/action/Kernel.cc index 3ebb5bc1d..eb57bfa1f 100644 --- a/ceph/src/tools/rbd/action/Kernel.cc +++ b/ceph/src/tools/rbd/action/Kernel.cc @@ -64,6 +64,29 @@ static std::string map_option_int_cb(const char *value_char) return stringify(d); } +static std::string map_option_string_cb(const char *value_char) +{ + return value_char; +} + +static std::string map_option_read_from_replica_cb(const char *value_char) +{ + if (!strcmp(value_char, "no") || !strcmp(value_char, "balance") || + !strcmp(value_char, "localize")) { + return value_char; + } + return ""; +} + +static std::string map_option_compression_hint_cb(const char *value_char) +{ + if (!strcmp(value_char, "none") || !strcmp(value_char, "compressible") || + !strcmp(value_char, "incompressible")) { + return value_char; + } + return ""; +} + static void put_map_option(const std::string &key, const std::string &val) { map_options[key] = val; @@ -153,6 +176,18 @@ static int parse_map_options(const std::string &options_string) } else if (!strcmp(this_char, "alloc_size")) { if (put_map_option_value("alloc_size", value_char, map_option_int_cb)) return -EINVAL; + } else if (!strcmp(this_char, "crush_location")) { + if (put_map_option_value("crush_location", value_char, + map_option_string_cb)) + return -EINVAL; + } else if (!strcmp(this_char, "read_from_replica")) { + if (put_map_option_value("read_from_replica", value_char, + map_option_read_from_replica_cb)) + return -EINVAL; + } else if (!strcmp(this_char, "compression_hint")) { + if (put_map_option_value("compression_hint", value_char, + map_option_compression_hint_cb)) + return -EINVAL; } else { std::cerr << "rbd: unknown map option '" << this_char << "'" << std::endl; return -EINVAL;