mirror of
https://github.com/ceph/ceph
synced 2024-12-29 15:03:33 +00:00
rbd: support pool and image level overrides for rbd_default_map_options
Fixes: https://tracker.ceph.com/issues/52850 Signed-off-by: Christopher Hoffman <choffman@redhat.com>
This commit is contained in:
parent
d11d2e72da
commit
9afc971282
@ -28,7 +28,6 @@ typedef std::map<std::string_view, std::pair<std::string, config_source_t>> Pare
|
||||
static std::set<std::string_view> EXCLUDE_OPTIONS {
|
||||
"rbd_auto_exclusive_lock_until_manual_request",
|
||||
"rbd_default_format",
|
||||
"rbd_default_map_options",
|
||||
"rbd_default_pool",
|
||||
"rbd_discard_on_zeroed_write_same",
|
||||
"rbd_op_thread_timeout",
|
||||
|
@ -549,14 +549,33 @@ int execute_map(const po::variables_map &vm,
|
||||
|
||||
utils::normalize_pool_name(&pool_name);
|
||||
|
||||
librados::IoCtx ioctx;
|
||||
librbd::Image image;
|
||||
r = utils::init_io_ctx(rados, pool_name, nspace_name, &ioctx);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
|
||||
r = utils::open_image(ioctx, image_name, true, &image);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
|
||||
MapOptions default_map_options;
|
||||
r = parse_map_options(
|
||||
g_conf().get_val<std::string>("rbd_default_map_options"),
|
||||
&default_map_options);
|
||||
std::vector<librbd::config_option_t> options;
|
||||
image.config_list(&options);
|
||||
for (const auto &option : options) {
|
||||
if (option.name == "rbd_default_map_options") {
|
||||
r = parse_map_options(option.value, &default_map_options);
|
||||
if (r < 0) {
|
||||
std::cerr << "rbd: couldn't parse default map options" << std::endl;
|
||||
return r;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& [key, value] : default_map_options) {
|
||||
if (map_options.count(key) == 0) {
|
||||
map_options[key] = value;
|
||||
|
Loading…
Reference in New Issue
Block a user