diff --git a/src/common/legacy_config_opts.h b/src/common/legacy_config_opts.h
index c65b52acb6061..0fcc06cd9ecef 100644
--- a/src/common/legacy_config_opts.h
+++ b/src/common/legacy_config_opts.h
@@ -1302,110 +1302,6 @@ OPTION(rados_mon_op_timeout, OPT_DOUBLE) // how many seconds to wait for a respo
OPTION(rados_osd_op_timeout, OPT_DOUBLE) // how many seconds to wait for a response from osds before returning an error from a rados operation. 0 means no limit.
OPTION(rados_tracing, OPT_BOOL) // true if LTTng-UST tracepoints should be enabled
-OPTION(rbd_op_threads, OPT_INT)
-OPTION(rbd_op_thread_timeout, OPT_INT)
-OPTION(rbd_non_blocking_aio, OPT_BOOL) // process AIO ops from a worker thread to prevent blocking
-OPTION(rbd_cache, OPT_BOOL) // whether to enable caching (writeback unless rbd_cache_max_dirty is 0)
-OPTION(rbd_cache_writethrough_until_flush, OPT_BOOL) // whether to make writeback caching writethrough until flush is called, to be sure the user of librbd will send flushs so that writeback is safe
-OPTION(rbd_cache_size, OPT_LONGLONG) // cache size in bytes
-OPTION(rbd_cache_max_dirty, OPT_LONGLONG) // dirty limit in bytes - set to 0 for write-through caching
-OPTION(rbd_cache_target_dirty, OPT_LONGLONG) // target dirty limit in bytes
-OPTION(rbd_cache_max_dirty_age, OPT_FLOAT) // seconds in cache before writeback starts
-OPTION(rbd_cache_max_dirty_object, OPT_INT) // dirty limit for objects - set to 0 for auto calculate from rbd_cache_size
-OPTION(rbd_cache_block_writes_upfront, OPT_BOOL) // whether to block writes to the cache before the aio_write call completes (true))
-OPTION(rbd_concurrent_management_ops, OPT_INT) // how many operations can be in flight for a management operation like deleting or resizing an image
-OPTION(rbd_balance_snap_reads, OPT_BOOL)
-OPTION(rbd_localize_snap_reads, OPT_BOOL)
-OPTION(rbd_balance_parent_reads, OPT_BOOL)
-OPTION(rbd_localize_parent_reads, OPT_BOOL)
-OPTION(rbd_readahead_trigger_requests, OPT_INT) // number of sequential requests necessary to trigger readahead
-OPTION(rbd_readahead_max_bytes, OPT_LONGLONG) // set to 0 to disable readahead
-OPTION(rbd_readahead_disable_after_bytes, OPT_LONGLONG) // how many bytes are read in total before readahead is disabled
-OPTION(rbd_clone_copy_on_read, OPT_BOOL)
-OPTION(rbd_blacklist_on_break_lock, OPT_BOOL) // whether to blacklist clients whose lock was broken
-OPTION(rbd_blacklist_expire_seconds, OPT_INT) // number of seconds to blacklist - set to 0 for OSD default
-OPTION(rbd_request_timed_out_seconds, OPT_INT) // number of seconds before maint request times out
-OPTION(rbd_skip_partial_discard, OPT_BOOL) // when trying to discard a range inside an object, set to true to skip zeroing the range.
-OPTION(rbd_enable_alloc_hint, OPT_BOOL) // when writing a object, it will issue a hint to osd backend to indicate the expected size object need
-OPTION(rbd_tracing, OPT_BOOL) // true if LTTng-UST tracepoints should be enabled
-OPTION(rbd_blkin_trace_all, OPT_BOOL) // create a blkin trace for all RBD requests
-OPTION(rbd_validate_pool, OPT_BOOL) // true if empty pools should be validated for RBD compatibility
-OPTION(rbd_validate_names, OPT_BOOL) // true if image specs should be validated
-OPTION(rbd_auto_exclusive_lock_until_manual_request, OPT_BOOL) // whether to automatically acquire/release exclusive lock until it is explicitly requested, i.e. before we know the user of librbd is properly using the lock API
-OPTION(rbd_mirroring_resync_after_disconnect, OPT_BOOL) // automatically start image resync after mirroring is disconnected due to being laggy
-OPTION(rbd_mirroring_replay_delay, OPT_INT) // time-delay in seconds for rbd-mirror asynchronous replication
-
-OPTION(rbd_default_pool, OPT_STR) // default pool for storing images
-
-/*
- * The following options change the behavior for librbd's image creation methods that
- * don't require all of the parameters. These are provided so that older programs
- * can take advantage of newer features without being rewritten to use new versions
- * of the image creation functions.
- *
- * rbd_create()/RBD::create() are affected by all of these options.
- *
- * rbd_create2()/RBD::create2() and rbd_clone()/RBD::clone() are affected by:
- * - rbd_default_order
- * - rbd_default_stripe_count
- * - rbd_default_stripe_size
- *
- * rbd_create3()/RBD::create3() and rbd_clone2/RBD::clone2() are only
- * affected by rbd_default_order.
- */
-OPTION(rbd_default_format, OPT_INT)
-OPTION(rbd_default_order, OPT_INT)
-OPTION(rbd_default_stripe_count, OPT_U64) // changing requires stripingv2 feature
-OPTION(rbd_default_stripe_unit, OPT_U64) // changing to non-object size requires stripingv2 feature
-OPTION(rbd_default_data_pool, OPT_STR) // optional default pool for storing image data blocks
-
-/**
- * RBD features are only applicable for v2 images. This setting accepts either
- * an integer bitmask value or comma-delimited string of RBD feature names.
- * This setting is always internally stored as an integer bitmask value. The
- * mapping between feature bitmask value and feature name is as follows:
- *
- * +1 -> layering
- * +2 -> striping
- * +4 -> exclusive-lock
- * +8 -> object-map
- * +16 -> fast-diff
- * +32 -> deep-flatten
- * +64 -> journaling
- * +128 -> data-pool
- */
-SAFE_OPTION(rbd_default_features, OPT_STR)
-
-OPTION(rbd_default_map_options, OPT_STR) // default rbd map -o / --options
-
-/**
- * RBD journal options.
- */
-OPTION(rbd_journal_order, OPT_U32) // bits to shift to compute journal object max size, between 12 and 64
-OPTION(rbd_journal_splay_width, OPT_U32) // number of active journal objects
-OPTION(rbd_journal_commit_age, OPT_DOUBLE) // commit time interval, seconds
-OPTION(rbd_journal_object_flush_interval, OPT_INT) // maximum number of pending commits per journal object
-OPTION(rbd_journal_object_flush_bytes, OPT_INT) // maximum number of pending bytes per journal object
-OPTION(rbd_journal_object_flush_age, OPT_DOUBLE) // maximum age (in seconds) for pending commits
-OPTION(rbd_journal_pool, OPT_STR) // pool for journal objects
-OPTION(rbd_journal_max_payload_bytes, OPT_U32) // maximum journal payload size before splitting
-OPTION(rbd_journal_max_concurrent_object_sets, OPT_INT) // maximum number of object sets a journal client can be behind before it is automatically unregistered
-
-/**
- * RBD Mirror options
- */
-OPTION(rbd_mirror_journal_commit_age, OPT_DOUBLE) // commit time interval, seconds
-OPTION(rbd_mirror_journal_poll_age, OPT_DOUBLE) // maximum age (in seconds) between successive journal polls
-OPTION(rbd_mirror_journal_max_fetch_bytes, OPT_U32) // maximum bytes to read from each journal data object per fetch
-OPTION(rbd_mirror_sync_point_update_age, OPT_DOUBLE) // number of seconds between each update of the image sync point object number
-OPTION(rbd_mirror_concurrent_image_syncs, OPT_U32) // maximum number of image syncs in parallel
-OPTION(rbd_mirror_pool_replayers_refresh_interval, OPT_INT) // interval to refresh peers in rbd-mirror daemon
-OPTION(rbd_mirror_delete_retry_interval, OPT_DOUBLE) // interval to check and retry the failed requests in deleter
-OPTION(rbd_mirror_image_state_check_interval, OPT_INT) // interval to get images from pool watcher and set sources in replayer
-OPTION(rbd_mirror_leader_heartbeat_interval, OPT_INT) // interval (in seconds) between mirror leader heartbeats
-OPTION(rbd_mirror_leader_max_missed_heartbeats, OPT_INT) // number of missed heartbeats for non-lock owner to attempt to acquire lock
-OPTION(rbd_mirror_leader_max_acquire_attempts_before_break, OPT_INT) // number of failed attempts to acquire lock after missing heartbeats before breaking lock
-
OPTION(nss_db_path, OPT_STR) // path to nss db
diff --git a/src/common/options.cc b/src/common/options.cc
index 6166ef3f8d50b..647b7b4ac994d 100644
--- a/src/common/options.cc
+++ b/src/common/options.cc
@@ -4944,7 +4944,7 @@ static std::vector get_rbd_options() {
return std::vector ({
Option("rbd_default_pool", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("rbd")
- .set_description("")
+ .set_description("default pool for storing new images")
.set_validator([](std::string *value, std::string *error_message){
boost::regex pattern("^[^@/]+$");
if (!boost::regex_match (*value, pattern)) {
@@ -4956,7 +4956,7 @@ static std::vector get_rbd_options() {
Option("rbd_default_data_pool", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("")
- .set_description("")
+ .set_description("default pool for storing data blocks for new images")
.set_validator([](std::string *value, std::string *error_message){
boost::regex pattern("^[^@/]*$");
if (!boost::regex_match (*value, pattern)) {
@@ -4968,7 +4968,15 @@ static std::vector get_rbd_options() {
Option("rbd_default_features", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("layering,exclusive-lock,object-map,fast-diff,deep-flatten")
- .set_description("")
+ .set_description("default v2 image features for new images")
+ .set_long_description(
+ "RBD features are only applicable for v2 images. This setting accepts "
+ "either an integer bitmask value or comma-delimited string of RBD "
+ "feature names. This setting is always internally stored as an integer "
+ "bitmask value. The mapping between feature bitmask value and feature "
+ "name is as follows: +1 -> layering, +2 -> striping, "
+ "+4 -> exclusive-lock, +8 -> object-map, +16 -> fast-diff, "
+ "+32 -> deep-flatten, +64 -> journaling, +128 -> data-pool")
.set_safe()
.set_validator([](std::string *value, std::string *error_message){
static const std::map FEATURE_MAP = {
@@ -5029,234 +5037,241 @@ static std::vector get_rbd_options() {
Option("rbd_op_threads", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(1)
- .set_description(""),
+ .set_description("number of threads to utilize for internal processing"),
Option("rbd_op_thread_timeout", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(60)
- .set_description(""),
+ .set_description("time in seconds for detecting a hung thread"),
Option("rbd_non_blocking_aio", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
- .set_description(""),
+ .set_description("process AIO ops from a dispatch thread to prevent blocking"),
Option("rbd_cache", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
- .set_description(""),
+ .set_description("whether to enable caching (writeback unless rbd_cache_max_dirty is 0)"),
Option("rbd_cache_writethrough_until_flush", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
- .set_description(""),
+ .set_description("whether to make writeback caching writethrough until "
+ "flush is called, to be sure the user of librbd will send "
+ "flushes so that writeback is safe"),
Option("rbd_cache_size", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(32<<20)
- .set_description(""),
+ .set_description("cache size in bytes"),
Option("rbd_cache_max_dirty", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(24<<20)
- .set_description(""),
+ .set_description("dirty limit in bytes - set to 0 for write-through caching"),
Option("rbd_cache_target_dirty", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(16<<20)
- .set_description(""),
+ .set_description("target dirty limit in bytes"),
Option("rbd_cache_max_dirty_age", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
.set_default(1.0)
- .set_description(""),
+ .set_description("seconds in cache before writeback starts"),
Option("rbd_cache_max_dirty_object", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(0)
- .set_description(""),
+ .set_description("dirty limit for objects - set to 0 for auto calculate from rbd_cache_size"),
Option("rbd_cache_block_writes_upfront", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
- .set_description(""),
+ .set_description("whether to block writes to the cache before the aio_write call completes"),
Option("rbd_concurrent_management_ops", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(10)
.set_min(1)
- .set_description(""),
+ .set_description("how many operations can be in flight for a management operation like deleting or resizing an image"),
Option("rbd_balance_snap_reads", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
- .set_description(""),
+ .set_description("distribute snap read requests to random OSD"),
Option("rbd_localize_snap_reads", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
- .set_description(""),
+ .set_description("localize snap read requests to closest OSD"),
Option("rbd_balance_parent_reads", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
- .set_description(""),
+ .set_description("distribute parent read requests to random OSD"),
Option("rbd_localize_parent_reads", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
- .set_description(""),
+ .set_description("localize parent requests to closest OSD"),
Option("rbd_readahead_trigger_requests", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(10)
- .set_description(""),
+ .set_description("number of sequential requests necessary to trigger readahead"),
Option("rbd_readahead_max_bytes", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(512 * 1024)
- .set_description(""),
+ .set_description("set to 0 to disable readahead"),
Option("rbd_readahead_disable_after_bytes", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(50 * 1024 * 1024)
- .set_description(""),
+ .set_description("how many bytes are read in total before readahead is disabled"),
Option("rbd_clone_copy_on_read", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
- .set_description(""),
+ .set_description("copy-up parent image blocks to clone upon read request"),
Option("rbd_blacklist_on_break_lock", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
- .set_description(""),
+ .set_description("whether to blacklist clients whose lock was broken"),
Option("rbd_blacklist_expire_seconds", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(0)
- .set_description(""),
+ .set_description("number of seconds to blacklist - set to 0 for OSD default"),
Option("rbd_request_timed_out_seconds", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(30)
- .set_description(""),
+ .set_description("number of seconds before maintenance request times out"),
Option("rbd_skip_partial_discard", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
- .set_description(""),
+ .set_description("when trying to discard a range inside an object, set to true to skip zeroing the range"),
Option("rbd_enable_alloc_hint", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
- .set_description(""),
+ .set_description("when writing a object, it will issue a hint to osd backend to indicate the expected size object need"),
Option("rbd_tracing", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
- .set_description(""),
+ .set_description("true if LTTng-UST tracepoints should be enabled"),
Option("rbd_blkin_trace_all", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
- .set_description(""),
+ .set_description("create a blkin trace for all RBD requests"),
Option("rbd_validate_pool", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
- .set_description(""),
+ .set_description("validate empty pools for RBD compatibility"),
Option("rbd_validate_names", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
- .set_description(""),
+ .set_description("validate new image names for RBD compatibility"),
Option("rbd_auto_exclusive_lock_until_manual_request", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
- .set_description(""),
+ .set_description("automatically acquire/release exclusive lock until it is explicitly requested"),
Option("rbd_mirroring_resync_after_disconnect", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
- .set_description(""),
+ .set_description("automatically start image resync after mirroring is disconnected due to being laggy"),
Option("rbd_mirroring_replay_delay", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(0)
- .set_description(""),
+ .set_description("time-delay in seconds for rbd-mirror asynchronous replication"),
Option("rbd_default_format", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(2)
- .set_description(""),
+ .set_description("default image format for new images"),
Option("rbd_default_order", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(22)
- .set_description(""),
+ .set_description("default order (data block object size) for new images"),
Option("rbd_default_stripe_count", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
.set_default(0)
- .set_description(""),
+ .set_description("default stripe count for new images"),
Option("rbd_default_stripe_unit", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
.set_default(0)
- .set_description(""),
+ .set_description("default stripe width for new images"),
Option("rbd_default_map_options", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("")
- .set_description(""),
+ .set_description("default krbd map options"),
Option("rbd_journal_order", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
+ .set_min(12)
.set_default(24)
- .set_description(""),
+ .set_description("default order (object size) for journal data objects"),
Option("rbd_journal_splay_width", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
.set_default(4)
- .set_description(""),
+ .set_description("number of active journal objects"),
Option("rbd_journal_commit_age", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
.set_default(5)
- .set_description(""),
+ .set_description("commit time interval, seconds"),
Option("rbd_journal_object_flush_interval", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(0)
- .set_description(""),
+ .set_description("maximum number of pending commits per journal object"),
Option("rbd_journal_object_flush_bytes", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(0)
- .set_description(""),
+ .set_description("maximum number of pending bytes per journal object"),
Option("rbd_journal_object_flush_age", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
.set_default(0)
- .set_description(""),
+ .set_description("maximum age (in seconds) for pending commits"),
Option("rbd_journal_pool", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("")
- .set_description(""),
+ .set_description("pool for journal objects"),
Option("rbd_journal_max_payload_bytes", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
.set_default(16384)
- .set_description(""),
+ .set_description("maximum journal payload size before splitting"),
Option("rbd_journal_max_concurrent_object_sets", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(0)
- .set_description(""),
+ .set_description("maximum number of object sets a journal client can be behind before it is automatically unregistered"),
+ });
+}
+static std::vector get_rbd_mirror_options() {
+ return std::vector ({
Option("rbd_mirror_journal_commit_age", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
.set_default(5)
- .set_description(""),
+ .set_description("commit time interval, seconds"),
Option("rbd_mirror_journal_poll_age", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
.set_default(5)
- .set_description(""),
+ .set_description("maximum age (in seconds) between successive journal polls"),
Option("rbd_mirror_journal_max_fetch_bytes", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
.set_default(32768)
- .set_description(""),
+ .set_description("maximum bytes to read from each journal data object per fetch"),
Option("rbd_mirror_sync_point_update_age", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
.set_default(30)
- .set_description(""),
+ .set_description("number of seconds between each update of the image sync point object number"),
Option("rbd_mirror_concurrent_image_syncs", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
.set_default(5)
- .set_description(""),
+ .set_description("maximum number of image syncs in parallel"),
Option("rbd_mirror_pool_replayers_refresh_interval", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(30)
- .set_description(""),
+ .set_description("interval to refresh peers in rbd-mirror daemon"),
Option("rbd_mirror_delete_retry_interval", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
.set_default(30)
- .set_description(""),
+ .set_description("interval to check and retry the failed requests in deleter"),
Option("rbd_mirror_image_state_check_interval", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(30)
.set_min(1)
- .set_description(""),
+ .set_description("interval to get images from pool watcher and set sources in replayer"),
Option("rbd_mirror_leader_heartbeat_interval", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(5)
.set_min(1)
- .set_description(""),
+ .set_description("interval (in seconds) between mirror leader heartbeats"),
Option("rbd_mirror_leader_max_missed_heartbeats", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(2)
- .set_description(""),
+ .set_description("number of missed heartbeats for non-lock owner to attempt to acquire lock"),
Option("rbd_mirror_leader_max_acquire_attempts_before_break", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(3)
- .set_description(""),
+ .set_description("number of failed attempts to acquire lock after missing heartbeats before breaking lock"),
});
}
@@ -5939,6 +5954,7 @@ static std::vector build_options()
ingest(get_rgw_options(), "rgw");
ingest(get_rbd_options(), "rbd");
+ ingest(get_rbd_mirror_options(), "rbd-mirror");
ingest(get_mds_options(), "mds");
ingest(get_mds_client_options(), "mds_client");
diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc
index c97b11505d774..3db79a7ed30c2 100644
--- a/src/librbd/ImageCtx.cc
+++ b/src/librbd/ImageCtx.cc
@@ -60,7 +60,7 @@ class ThreadPoolSingleton : public ThreadPool {
: ThreadPool(cct, "librbd::thread_pool", "tp_librbd", 1,
"rbd_op_threads"),
op_work_queue(new ContextWQ("librbd::op_work_queue",
- cct->_conf->rbd_op_thread_timeout,
+ cct->_conf->get_val("rbd_op_thread_timeout"),
this)) {
start();
}
@@ -211,10 +211,11 @@ struct C_InvalidateCache : public Context {
ThreadPool *thread_pool;
get_thread_pool_instance(cct, &thread_pool, &op_work_queue);
io_work_queue = new io::ImageRequestWQ<>(
- this, "librbd::io_work_queue", cct->_conf->rbd_op_thread_timeout,
+ this, "librbd::io_work_queue",
+ cct->_conf->get_val("rbd_op_thread_timeout"),
thread_pool);
- if (cct->_conf->rbd_auto_exclusive_lock_until_manual_request) {
+ if (cct->_conf->get_val("rbd_auto_exclusive_lock_until_manual_request")) {
exclusive_lock_policy = new exclusive_lock::AutomaticPolicy(this);
} else {
exclusive_lock_policy = new exclusive_lock::StandardPolicy(this);
@@ -1013,50 +1014,51 @@ struct C_InvalidateCache : public Context {
}
}
-#define ASSIGN_OPTION(config) \
+#define ASSIGN_OPTION(config, type) \
do { \
string key = "rbd_"; \
key = key + #config; \
if (configs[key]) \
- config = local_config_t.rbd_##config; \
+ config = local_config_t.get_val("rbd_"#config); \
else \
- config = cct->_conf->rbd_##config; \
+ config = cct->_conf->get_val("rbd_"#config); \
} while (0);
- ASSIGN_OPTION(non_blocking_aio);
- ASSIGN_OPTION(cache);
- ASSIGN_OPTION(cache_writethrough_until_flush);
- ASSIGN_OPTION(cache_size);
- ASSIGN_OPTION(cache_max_dirty);
- ASSIGN_OPTION(cache_target_dirty);
- ASSIGN_OPTION(cache_max_dirty_age);
- ASSIGN_OPTION(cache_max_dirty_object);
- ASSIGN_OPTION(cache_block_writes_upfront);
- ASSIGN_OPTION(concurrent_management_ops);
- ASSIGN_OPTION(balance_snap_reads);
- ASSIGN_OPTION(localize_snap_reads);
- ASSIGN_OPTION(balance_parent_reads);
- ASSIGN_OPTION(localize_parent_reads);
- ASSIGN_OPTION(readahead_trigger_requests);
- ASSIGN_OPTION(readahead_max_bytes);
- ASSIGN_OPTION(readahead_disable_after_bytes);
- ASSIGN_OPTION(clone_copy_on_read);
- ASSIGN_OPTION(blacklist_on_break_lock);
- ASSIGN_OPTION(blacklist_expire_seconds);
- ASSIGN_OPTION(request_timed_out_seconds);
- ASSIGN_OPTION(enable_alloc_hint);
- ASSIGN_OPTION(journal_order);
- ASSIGN_OPTION(journal_splay_width);
- ASSIGN_OPTION(journal_commit_age);
- ASSIGN_OPTION(journal_object_flush_interval);
- ASSIGN_OPTION(journal_object_flush_bytes);
- ASSIGN_OPTION(journal_object_flush_age);
- ASSIGN_OPTION(journal_pool);
- ASSIGN_OPTION(journal_max_payload_bytes);
- ASSIGN_OPTION(journal_max_concurrent_object_sets);
- ASSIGN_OPTION(mirroring_resync_after_disconnect);
- ASSIGN_OPTION(mirroring_replay_delay);
- ASSIGN_OPTION(skip_partial_discard);
+ ASSIGN_OPTION(non_blocking_aio, bool);
+ ASSIGN_OPTION(cache, bool);
+ ASSIGN_OPTION(cache_writethrough_until_flush, bool);
+ ASSIGN_OPTION(cache_size, int64_t);
+ ASSIGN_OPTION(cache_max_dirty, int64_t);
+ ASSIGN_OPTION(cache_target_dirty, int64_t);
+ ASSIGN_OPTION(cache_max_dirty_age, double);
+ ASSIGN_OPTION(cache_max_dirty_object, int64_t);
+ ASSIGN_OPTION(cache_block_writes_upfront, bool);
+ ASSIGN_OPTION(concurrent_management_ops, int64_t);
+ ASSIGN_OPTION(balance_snap_reads, bool);
+ ASSIGN_OPTION(localize_snap_reads, bool);
+ ASSIGN_OPTION(balance_parent_reads, bool);
+ ASSIGN_OPTION(localize_parent_reads, bool);
+ ASSIGN_OPTION(readahead_trigger_requests, int64_t);
+ ASSIGN_OPTION(readahead_max_bytes, int64_t);
+ ASSIGN_OPTION(readahead_disable_after_bytes, int64_t);
+ ASSIGN_OPTION(clone_copy_on_read, bool);
+ ASSIGN_OPTION(blacklist_on_break_lock, bool);
+ ASSIGN_OPTION(blacklist_expire_seconds, int64_t);
+ ASSIGN_OPTION(request_timed_out_seconds, int64_t);
+ ASSIGN_OPTION(enable_alloc_hint, bool);
+ ASSIGN_OPTION(journal_order, uint64_t);
+ ASSIGN_OPTION(journal_splay_width, uint64_t);
+ ASSIGN_OPTION(journal_commit_age, double);
+ ASSIGN_OPTION(journal_object_flush_interval, int64_t);
+ ASSIGN_OPTION(journal_object_flush_bytes, int64_t);
+ ASSIGN_OPTION(journal_object_flush_age, double);
+ ASSIGN_OPTION(journal_pool, std::string);
+ ASSIGN_OPTION(journal_max_payload_bytes, uint64_t);
+ ASSIGN_OPTION(journal_max_concurrent_object_sets, int64_t);
+ ASSIGN_OPTION(mirroring_resync_after_disconnect, bool);
+ ASSIGN_OPTION(mirroring_replay_delay, int64_t);
+ ASSIGN_OPTION(skip_partial_discard, bool);
+ ASSIGN_OPTION(blkin_trace_all, bool);
}
ExclusiveLock *ImageCtx::create_exclusive_lock() {
diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h
index 2bda521f15423..6fcad3c27e9ce 100644
--- a/src/librbd/ImageCtx.h
+++ b/src/librbd/ImageCtx.h
@@ -196,6 +196,7 @@ namespace librbd {
bool mirroring_resync_after_disconnect;
int mirroring_replay_delay;
bool skip_partial_discard;
+ bool blkin_trace_all;
LibrbdAdminSocketHook *asok_hook;
diff --git a/src/librbd/ImageState.cc b/src/librbd/ImageState.cc
index ba4151a0005d6..5c2d92a4eedc7 100644
--- a/src/librbd/ImageState.cc
+++ b/src/librbd/ImageState.cc
@@ -216,7 +216,7 @@ class ImageUpdateWatchers {
m_cct->lookup_or_create_singleton_object(
thread_pool_singleton, "librbd::ImageUpdateWatchers::thread_pool");
m_work_queue = new ContextWQ("librbd::ImageUpdateWatchers::op_work_queue",
- m_cct->_conf->rbd_op_thread_timeout,
+ m_cct->_conf->get_val("rbd_op_thread_timeout"),
thread_pool_singleton);
}
diff --git a/src/librbd/ImageWatcher.cc b/src/librbd/ImageWatcher.cc
index ca612a9ded86a..487eabaa69c18 100644
--- a/src/librbd/ImageWatcher.cc
+++ b/src/librbd/ImageWatcher.cc
@@ -425,7 +425,8 @@ void ImageWatcher::handle_request_lock(int r) {
schedule_request_lock(true);
} else {
// lock owner acked -- but resend if we don't see them release the lock
- int retry_timeout = m_image_ctx.cct->_conf->client_notify_timeout;
+ int retry_timeout = m_image_ctx.cct->_conf->template get_val(
+ "client_notify_timeout");
ldout(m_image_ctx.cct, 15) << this << " will retry in " << retry_timeout
<< " seconds" << dendl;
schedule_request_lock(true, retry_timeout);
diff --git a/src/librbd/Journal.cc b/src/librbd/Journal.cc
index aa73cdeddac73..9fe57cd3f7b87 100644
--- a/src/librbd/Journal.cc
+++ b/src/librbd/Journal.cc
@@ -337,7 +337,7 @@ Journal::Journal(I &image_ctx)
cct->lookup_or_create_singleton_object(
thread_pool_singleton, "librbd::journal::thread_pool");
m_work_queue = new ContextWQ("librbd::journal::work_queue",
- cct->_conf->rbd_op_thread_timeout,
+ cct->_conf->get_val("rbd_op_thread_timeout"),
thread_pool_singleton);
ImageCtx::get_timer_instance(cct, &m_timer, &m_timer_lock);
}
diff --git a/src/librbd/image/CreateRequest.cc b/src/librbd/image/CreateRequest.cc
index f7376db9a85e6..9f43ebc6a2e60 100644
--- a/src/librbd/image/CreateRequest.cc
+++ b/src/librbd/image/CreateRequest.cc
@@ -164,29 +164,29 @@ CreateRequest::CreateRequest(IoCtx &ioctx, const std::string &image_name,
if (image_options.get(RBD_IMAGE_OPTION_STRIPE_UNIT, &m_stripe_unit) != 0 ||
m_stripe_unit == 0) {
- m_stripe_unit = m_cct->_conf->rbd_default_stripe_unit;
+ m_stripe_unit = m_cct->_conf->get_val("rbd_default_stripe_unit");
}
if (image_options.get(RBD_IMAGE_OPTION_STRIPE_COUNT, &m_stripe_count) != 0 ||
m_stripe_count == 0) {
- m_stripe_count = m_cct->_conf->rbd_default_stripe_count;
+ m_stripe_count = m_cct->_conf->get_val("rbd_default_stripe_count");
}
if (get_image_option(image_options, RBD_IMAGE_OPTION_ORDER, &m_order) != 0 ||
m_order == 0) {
- m_order = m_cct->_conf->rbd_default_order;
+ m_order = m_cct->_conf->get_val("rbd_default_order");
}
if (get_image_option(image_options, RBD_IMAGE_OPTION_JOURNAL_ORDER,
&m_journal_order) != 0) {
- m_journal_order = m_cct->_conf->rbd_journal_order;
+ m_journal_order = m_cct->_conf->get_val("rbd_journal_order");
}
if (get_image_option(image_options, RBD_IMAGE_OPTION_JOURNAL_SPLAY_WIDTH,
&m_journal_splay_width) != 0) {
- m_journal_splay_width = m_cct->_conf->rbd_journal_splay_width;
+ m_journal_splay_width = m_cct->_conf->get_val("rbd_journal_splay_width");
}
if (image_options.get(RBD_IMAGE_OPTION_JOURNAL_POOL, &m_journal_pool) != 0) {
- m_journal_pool = m_cct->_conf->rbd_journal_pool;
+ m_journal_pool = m_cct->_conf->get_val("rbd_journal_pool");
}
if (image_options.get(RBD_IMAGE_OPTION_DATA_POOL, &m_data_pool) != 0) {
- m_data_pool = m_cct->_conf->rbd_default_data_pool;
+ m_data_pool = m_cct->_conf->get_val("rbd_default_data_pool");
}
m_layout.object_size = 1ull << m_order;
@@ -268,7 +268,7 @@ void CreateRequest::send() {
template
void CreateRequest::validate_pool() {
- if (!m_cct->_conf->rbd_validate_pool) {
+ if (!m_cct->_conf->get_val("rbd_validate_pool")) {
create_id_object();
return;
}
diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc
index 70c706c6d4bee..3198a5c3a9cad 100644
--- a/src/librbd/internal.cc
+++ b/src/librbd/internal.cc
@@ -75,7 +75,7 @@ namespace librbd {
namespace {
int validate_pool(IoCtx &io_ctx, CephContext *cct) {
- if (!cct->_conf->rbd_validate_pool) {
+ if (!cct->_conf->get_val("rbd_validate_pool")) {
return 0;
}
@@ -833,7 +833,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
uint64_t format;
if (opts.get(RBD_IMAGE_OPTION_FORMAT, &format) != 0)
- format = cct->_conf->rbd_default_format;
+ format = cct->_conf->get_val("rbd_default_format");
bool old_format = format == 1;
// make sure it doesn't already exist, in either format
@@ -850,7 +850,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
uint64_t order = 0;
if (opts.get(RBD_IMAGE_OPTION_ORDER, &order) != 0 || order == 0) {
- order = cct->_conf->rbd_default_order;
+ order = cct->_conf->get_val("rbd_default_order");
}
r = image::CreateRequest<>::validate_order(cct, order);
if (r < 0) {
@@ -1906,7 +1906,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
}
ZTracer::Trace trace;
- if (cct->_conf->rbd_blkin_trace_all) {
+ if (src->blkin_trace_all) {
trace.init("copy", &src->trace_endpoint);
}
@@ -2147,7 +2147,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
uint64_t left = mylen;
ZTracer::Trace trace;
- if (ictx->cct->_conf->rbd_blkin_trace_all) {
+ if (ictx->blkin_trace_all) {
trace.init("read_iterate", &ictx->trace_endpoint);
}
diff --git a/src/librbd/io/ImageRequestWQ.cc b/src/librbd/io/ImageRequestWQ.cc
index 4cc8e0148dd19..81800cc4ae73c 100644
--- a/src/librbd/io/ImageRequestWQ.cc
+++ b/src/librbd/io/ImageRequestWQ.cc
@@ -200,7 +200,7 @@ void ImageRequestWQ::aio_read(AioCompletion *c, uint64_t off, uint64_t len,
bool native_async) {
CephContext *cct = m_image_ctx.cct;
ZTracer::Trace trace;
- if (cct->_conf->rbd_blkin_trace_all) {
+ if (m_image_ctx.blkin_trace_all) {
trace.init("wq: read", &m_image_ctx.trace_endpoint);
trace.event("start");
}
@@ -241,7 +241,7 @@ void ImageRequestWQ::aio_write(AioCompletion *c, uint64_t off, uint64_t len,
bool native_async) {
CephContext *cct = m_image_ctx.cct;
ZTracer::Trace trace;
- if (cct->_conf->rbd_blkin_trace_all) {
+ if (m_image_ctx.blkin_trace_all) {
trace.init("wq: write", &m_image_ctx.trace_endpoint);
trace.event("init");
}
@@ -278,7 +278,7 @@ void ImageRequestWQ::aio_discard(AioCompletion *c, uint64_t off,
bool native_async) {
CephContext *cct = m_image_ctx.cct;
ZTracer::Trace trace;
- if (cct->_conf->rbd_blkin_trace_all) {
+ if (m_image_ctx.blkin_trace_all) {
trace.init("wq: discard", &m_image_ctx.trace_endpoint);
trace.event("init");
}
@@ -313,7 +313,7 @@ template
void ImageRequestWQ::aio_flush(AioCompletion *c, bool native_async) {
CephContext *cct = m_image_ctx.cct;
ZTracer::Trace trace;
- if (cct->_conf->rbd_blkin_trace_all) {
+ if (m_image_ctx.blkin_trace_all) {
trace.init("wq: flush", &m_image_ctx.trace_endpoint);
trace.event("init");
}
@@ -346,7 +346,7 @@ void ImageRequestWQ::aio_writesame(AioCompletion *c, uint64_t off,
int op_flags, bool native_async) {
CephContext *cct = m_image_ctx.cct;
ZTracer::Trace trace;
- if (cct->_conf->rbd_blkin_trace_all) {
+ if (m_image_ctx.blkin_trace_all) {
trace.init("wq: writesame", &m_image_ctx.trace_endpoint);
trace.event("init");
}
@@ -387,7 +387,7 @@ void ImageRequestWQ::aio_compare_and_write(AioCompletion *c,
int op_flags, bool native_async) {
CephContext *cct = m_image_ctx.cct;
ZTracer::Trace trace;
- if (cct->_conf->rbd_blkin_trace_all) {
+ if (m_image_ctx.blkin_trace_all) {
trace.init("wq: compare_and_write", &m_image_ctx.trace_endpoint);
trace.event("init");
}
diff --git a/src/librbd/operation/ObjectMapIterate.cc b/src/librbd/operation/ObjectMapIterate.cc
index 35119e0f5cd2d..1e4b854bddd50 100644
--- a/src/librbd/operation/ObjectMapIterate.cc
+++ b/src/librbd/operation/ObjectMapIterate.cc
@@ -256,7 +256,7 @@ void ObjectMapIterateRequest::send_verify_objects() {
AsyncObjectThrottle *throttle = new AsyncObjectThrottle(
this, m_image_ctx, context_factory, this->create_callback_context(),
&m_prog_ctx, 0, num_objects);
- throttle->start_ops(cct->_conf->rbd_concurrent_management_ops);
+ throttle->start_ops(m_image_ctx.concurrent_management_ops);
}
template
diff --git a/src/test/librbd/journal/test_Entries.cc b/src/test/librbd/journal/test_Entries.cc
index 33e162a0f5e63..54be1487faed8 100644
--- a/src/test/librbd/journal/test_Entries.cc
+++ b/src/test/librbd/journal/test_Entries.cc
@@ -164,7 +164,7 @@ TEST_F(TestJournalEntries, AioDiscard) {
REQUIRE_FEATURE(RBD_FEATURE_JOURNALING);
CephContext* cct = reinterpret_cast(_rados.cct());
- REQUIRE(!cct->_conf->rbd_skip_partial_discard);
+ REQUIRE(!cct->_conf->get_val("rbd_skip_partial_discard"));
librbd::ImageCtx *ictx;
ASSERT_EQ(0, open_image(m_image_name, &ictx));
@@ -175,7 +175,7 @@ TEST_F(TestJournalEntries, AioDiscard) {
C_SaferCond cond_ctx;
auto c = librbd::io::AioCompletion::create(&cond_ctx);
c->get();
- ictx->io_work_queue->aio_discard(c, 123, 234, cct->_conf->rbd_skip_partial_discard);
+ ictx->io_work_queue->aio_discard(c, 123, 234, ictx->skip_partial_discard);
ASSERT_EQ(0, c->wait_for_complete());
c->put();
diff --git a/src/test/librbd/journal/test_Replay.cc b/src/test/librbd/journal/test_Replay.cc
index 7c735695b8e89..d8c651858a822 100644
--- a/src/test/librbd/journal/test_Replay.cc
+++ b/src/test/librbd/journal/test_Replay.cc
@@ -143,7 +143,8 @@ TEST_F(TestJournalReplay, AioDiscardEvent) {
// inject a discard operation into the journal
inject_into_journal(ictx,
- librbd::journal::AioDiscardEvent(0, payload.size(), ictx->skip_partial_discard));
+ librbd::journal::AioDiscardEvent(0, payload.size(),
+ ictx->skip_partial_discard));
close_image(ictx);
// re-open the journal so that it replays the new entry
@@ -155,7 +156,7 @@ TEST_F(TestJournalReplay, AioDiscardEvent) {
librbd::io::ReadResult{read_result}, 0);
ASSERT_EQ(0, aio_comp->wait_for_complete());
aio_comp->release();
- if (ictx->cct->_conf->rbd_skip_partial_discard) {
+ if (ictx->skip_partial_discard) {
ASSERT_EQ(payload, read_payload);
} else {
ASSERT_EQ(std::string(read_payload.size(), '\0'), read_payload);
@@ -170,9 +171,11 @@ TEST_F(TestJournalReplay, AioDiscardEvent) {
// replay several envents and check the commit position
inject_into_journal(ictx,
- librbd::journal::AioDiscardEvent(0, payload.size(), ictx->cct->_conf->rbd_skip_partial_discard));
+ librbd::journal::AioDiscardEvent(0, payload.size(),
+ ictx->skip_partial_discard));
inject_into_journal(ictx,
- librbd::journal::AioDiscardEvent(0, payload.size(), ictx->cct->_conf->rbd_skip_partial_discard));
+ librbd::journal::AioDiscardEvent(0, payload.size(),
+ ictx->skip_partial_discard));
close_image(ictx);
ASSERT_EQ(0, open_image(m_image_name, &ictx));
@@ -183,7 +186,8 @@ TEST_F(TestJournalReplay, AioDiscardEvent) {
// verify lock ordering constraints
aio_comp = new librbd::io::AioCompletion();
- ictx->io_work_queue->aio_discard(aio_comp, 0, read_payload.size(), ictx->cct->_conf->rbd_skip_partial_discard);
+ ictx->io_work_queue->aio_discard(aio_comp, 0, read_payload.size(),
+ ictx->skip_partial_discard);
ASSERT_EQ(0, aio_comp->wait_for_complete());
aio_comp->release();
}
diff --git a/src/test/librbd/managed_lock/test_mock_AcquireRequest.cc b/src/test/librbd/managed_lock/test_mock_AcquireRequest.cc
index 174e97be49bf8..8f2f5f6ef2774 100644
--- a/src/test/librbd/managed_lock/test_mock_AcquireRequest.cc
+++ b/src/test/librbd/managed_lock/test_mock_AcquireRequest.cc
@@ -34,8 +34,9 @@ struct BreakRequest {
uint32_t blacklist_expire_seconds,
bool force_break_lock, Context *on_finish) {
CephContext *cct = reinterpret_cast(ioctx.cct());
- EXPECT_EQ(cct->_conf->rbd_blacklist_on_break_lock, blacklist_locker);
- EXPECT_EQ(cct->_conf->rbd_blacklist_expire_seconds,
+ EXPECT_EQ(cct->_conf->get_val("rbd_blacklist_on_break_lock"),
+ blacklist_locker);
+ EXPECT_EQ(cct->_conf->get_val("rbd_blacklist_expire_seconds"),
(int)blacklist_expire_seconds);
EXPECT_FALSE(force_break_lock);
assert(s_instance != nullptr);
diff --git a/src/test/librbd/mock/MockImageCtx.h b/src/test/librbd/mock/MockImageCtx.h
index 483b063e56f33..be439b985f722 100644
--- a/src/test/librbd/mock/MockImageCtx.h
+++ b/src/test/librbd/mock/MockImageCtx.h
@@ -105,7 +105,8 @@ struct MockImageCtx {
mirroring_resync_after_disconnect(
image_ctx.mirroring_resync_after_disconnect),
mirroring_replay_delay(image_ctx.mirroring_replay_delay),
- non_blocking_aio(image_ctx.non_blocking_aio)
+ non_blocking_aio(image_ctx.non_blocking_aio),
+ blkin_trace_all(image_ctx.blkin_trace_all)
{
md_ctx.dup(image_ctx.md_ctx);
data_ctx.dup(image_ctx.data_ctx);
@@ -297,6 +298,7 @@ struct MockImageCtx {
bool mirroring_resync_after_disconnect;
int mirroring_replay_delay;
bool non_blocking_aio;
+ bool blkin_trace_all;
};
} // namespace librbd
diff --git a/src/test/librbd/test_internal.cc b/src/test/librbd/test_internal.cc
index dd8d5a8cb0c63..7cc6e12cab9b9 100644
--- a/src/test/librbd/test_internal.cc
+++ b/src/test/librbd/test_internal.cc
@@ -718,7 +718,7 @@ TEST_F(TestInternal, DiscardCopyup)
REQUIRE_FEATURE(RBD_FEATURE_LAYERING);
CephContext* cct = reinterpret_cast(_rados.cct());
- REQUIRE(!cct->_conf->rbd_skip_partial_discard);
+ REQUIRE(!cct->_conf->get_val("rbd_skip_partial_discard"));
m_image_name = get_temp_image_name();
m_image_size = 1 << 14;
diff --git a/src/test/rbd_mirror/test_mock_LeaderWatcher.cc b/src/test/rbd_mirror/test_mock_LeaderWatcher.cc
index 2f458e6ad6411..2141a00f7a01d 100644
--- a/src/test/rbd_mirror/test_mock_LeaderWatcher.cc
+++ b/src/test/rbd_mirror/test_mock_LeaderWatcher.cc
@@ -623,8 +623,8 @@ TEST_F(TestMockLeaderWatcher, Break) {
EXPECT_EQ(0, _rados->conf_set("rbd_mirror_leader_max_missed_heartbeats",
"1"));
CephContext *cct = reinterpret_cast(m_local_io_ctx.cct());
- int max_acquire_attempts =
- cct->_conf->rbd_mirror_leader_max_acquire_attempts_before_break;
+ int max_acquire_attempts = cct->_conf->get_val(
+ "rbd_mirror_leader_max_acquire_attempts_before_break");
MockManagedLock mock_managed_lock;
MockMirrorStatusWatcher mock_mirror_status_watcher;
diff --git a/src/tools/rbd/Utils.cc b/src/tools/rbd/Utils.cc
index db248e34a1b72..69e34b738ab62 100644
--- a/src/tools/rbd/Utils.cc
+++ b/src/tools/rbd/Utils.cc
@@ -84,7 +84,7 @@ int read_string(int fd, unsigned max, std::string *out) {
int extract_spec(const std::string &spec, std::string *pool_name,
std::string *image_name, std::string *snap_name,
SpecValidation spec_validation) {
- if (!g_ceph_context->_conf->rbd_validate_names) {
+ if (!g_ceph_context->_conf->get_val("rbd_validate_names")) {
spec_validation = SPEC_VALIDATION_NONE;
}
@@ -184,7 +184,7 @@ std::string get_positional_argument(const po::variables_map &vm, size_t index) {
}
std::string get_default_pool_name() {
- return g_ceph_context->_conf->rbd_default_pool;
+ return g_ceph_context->_conf->get_val("rbd_default_pool");
}
std::string get_pool_name(const po::variables_map &vm, size_t *arg_index) {
diff --git a/src/tools/rbd/action/Export.cc b/src/tools/rbd/action/Export.cc
index 708663a43104f..bfda6980598a6 100644
--- a/src/tools/rbd/action/Export.cc
+++ b/src/tools/rbd/action/Export.cc
@@ -177,8 +177,8 @@ int do_export_diff_fd(librbd::Image& image, const char *fromsnapname,
}
}
ExportDiffContext edc(&image, fd, info.size,
- g_conf->rbd_concurrent_management_ops, no_progress,
- export_format);
+ g_conf->get_val("rbd_concurrent_management_ops"),
+ no_progress, export_format);
r = image.diff_iterate2(fromsnapname, 0, info.size, true, whole_object,
&C_ExportDiff::export_diff_cb, (void *)&edc);
if (r < 0) {
@@ -509,7 +509,7 @@ static int do_export(librbd::Image& image, const char *path, bool no_progress, i
fd = STDOUT_FILENO;
max_concurrent_ops = 1;
} else {
- max_concurrent_ops = g_conf->rbd_concurrent_management_ops;
+ max_concurrent_ops = g_conf->get_val("rbd_concurrent_management_ops");
fd = open(path, O_WRONLY | O_CREAT | O_EXCL, 0644);
if (fd < 0) {
return -errno;
diff --git a/src/tools/rbd/action/Import.cc b/src/tools/rbd/action/Import.cc
index 0f31d810394be..3c71785527057 100644
--- a/src/tools/rbd/action/Import.cc
+++ b/src/tools/rbd/action/Import.cc
@@ -37,7 +37,9 @@ struct ImportDiffContext {
ImportDiffContext(librbd::Image *image, int fd, size_t size, bool no_progress)
: image(image), fd(fd), size(size), pc("Importing image diff", no_progress),
throttle((fd == STDIN_FILENO) ? 1 :
- g_conf->rbd_concurrent_management_ops, false), last_offset(0) {
+ g_conf->get_val("rbd_concurrent_management_ops"),
+ false),
+ last_offset(0) {
}
void update_size(size_t new_size)
@@ -653,7 +655,7 @@ static int do_import_v1(int fd, librbd::Image &image, uint64_t size,
throttle.reset(new SimpleThrottle(1, false));
} else {
throttle.reset(new SimpleThrottle(
- g_conf->rbd_concurrent_management_ops, false));
+ g_conf->get_val("rbd_concurrent_management_ops"), false));
}
reqlen = min(reqlen, size);
@@ -746,7 +748,7 @@ static int do_import(librados::Rados &rados, librbd::RBD &rbd,
uint64_t order;
if (opts.get(RBD_IMAGE_OPTION_ORDER, &order) != 0) {
- order = g_conf->rbd_default_order;
+ order = g_conf->get_val("rbd_default_order");
}
// try to fill whole imgblklen blocks for sparsification
diff --git a/src/tools/rbd/action/Kernel.cc b/src/tools/rbd/action/Kernel.cc
index 1f1951fc88425..4f58cc27d83c8 100644
--- a/src/tools/rbd/action/Kernel.cc
+++ b/src/tools/rbd/action/Kernel.cc
@@ -414,7 +414,8 @@ int execute_map(const po::variables_map &vm) {
}
// parse default options first so they can be overwritten by cli options
- char *default_map_options = strdup(g_conf->rbd_default_map_options.c_str());
+ char *default_map_options = strdup(g_conf->get_val(
+ "rbd_default_map_options").c_str());
BOOST_SCOPE_EXIT( (default_map_options) ) {
free(default_map_options);
} BOOST_SCOPE_EXIT_END;
diff --git a/src/tools/rbd/action/List.cc b/src/tools/rbd/action/List.cc
index 4c4babe99489d..fbac3e1065591 100644
--- a/src/tools/rbd/action/List.cc
+++ b/src/tools/rbd/action/List.cc
@@ -290,7 +290,9 @@ int execute(const po::variables_map &vm) {
return r;
}
- r = do_list(pool_name, vm["long"].as(), g_conf->rbd_concurrent_management_ops, formatter.get());
+ r = do_list(pool_name, vm["long"].as(),
+ g_conf->get_val("rbd_concurrent_management_ops"),
+ formatter.get());
if (r < 0) {
std::cerr << "rbd: list: " << cpp_strerror(r) << std::endl;
return r;
diff --git a/src/tools/rbd/action/MirrorPool.cc b/src/tools/rbd/action/MirrorPool.cc
index 0090a42060b97..4314b1ed6b46d 100644
--- a/src/tools/rbd/action/MirrorPool.cc
+++ b/src/tools/rbd/action/MirrorPool.cc
@@ -459,7 +459,8 @@ class ImageRequestGenerator {
m_factory(std::bind(ImageRequestAllocator(),
std::ref(m_io_ctx), std::ref(m_throttle),
std::placeholders::_1, std::forward(args)...)),
- m_throttle(g_conf->rbd_concurrent_management_ops, true) {
+ m_throttle(g_conf->get_val("rbd_concurrent_management_ops"),
+ true) {
}
int execute() {
diff --git a/src/tools/rbd_mirror/ImageDeleter.cc b/src/tools/rbd_mirror/ImageDeleter.cc
index 07de6e93c38cf..333d11e06e494 100644
--- a/src/tools/rbd_mirror/ImageDeleter.cc
+++ b/src/tools/rbd_mirror/ImageDeleter.cc
@@ -147,7 +147,8 @@ ImageDeleter::ImageDeleter(ContextWQ *work_queue, SafeTimer *timer,
m_failed_timer_lock(timer_lock),
m_asok_hook(new ImageDeleterAdminSocketHook(g_ceph_context, this))
{
- set_failed_timer_interval(g_ceph_context->_conf->rbd_mirror_delete_retry_interval);
+ set_failed_timer_interval(g_ceph_context->_conf->get_val(
+ "rbd_mirror_delete_retry_interval"));
m_image_deleter_thread.create("image_deleter");
}
diff --git a/src/tools/rbd_mirror/ImageReplayer.cc b/src/tools/rbd_mirror/ImageReplayer.cc
index a84199968a253..2bb31b4b11dab 100644
--- a/src/tools/rbd_mirror/ImageReplayer.cc
+++ b/src/tools/rbd_mirror/ImageReplayer.cc
@@ -526,8 +526,10 @@ void ImageReplayer::bootstrap() {
CephContext *cct = static_cast(m_local->cct());
journal::Settings settings;
- settings.commit_interval = cct->_conf->rbd_mirror_journal_commit_age;
- settings.max_fetch_bytes = cct->_conf->rbd_mirror_journal_max_fetch_bytes;
+ settings.commit_interval = cct->_conf->get_val(
+ "rbd_mirror_journal_commit_age");
+ settings.max_fetch_bytes = cct->_conf->get_val(
+ "rbd_mirror_journal_max_fetch_bytes");
m_remote_journaler = new Journaler(m_threads->work_queue,
m_threads->timer,
@@ -717,7 +719,8 @@ void ImageReplayer::handle_start_replay(int r) {
{
CephContext *cct = static_cast(m_local->cct());
- double poll_seconds = cct->_conf->rbd_mirror_journal_poll_age;
+ double poll_seconds = cct->_conf->get_val(
+ "rbd_mirror_journal_poll_age");
Mutex::Locker locker(m_lock);
m_replay_handler = new ReplayHandler(this);
diff --git a/src/tools/rbd_mirror/ImageSyncThrottler.cc b/src/tools/rbd_mirror/ImageSyncThrottler.cc
index e5d08cea5f48e..dfa96ed4d3e46 100644
--- a/src/tools/rbd_mirror/ImageSyncThrottler.cc
+++ b/src/tools/rbd_mirror/ImageSyncThrottler.cc
@@ -31,8 +31,8 @@ template
ImageSyncThrottler::ImageSyncThrottler()
: m_lock(librbd::util::unique_lock_name("rbd::mirror::ImageSyncThrottler",
this)),
- m_max_concurrent_syncs(
- g_ceph_context->_conf->rbd_mirror_concurrent_image_syncs) {
+ m_max_concurrent_syncs(g_ceph_context->_conf->get_val(
+ "rbd_mirror_concurrent_image_syncs")) {
dout(20) << "max_concurrent_syncs=" << m_max_concurrent_syncs << dendl;
g_ceph_context->_conf->add_observer(this);
}
@@ -205,7 +205,7 @@ template
void ImageSyncThrottler::handle_conf_change(const struct md_config_t *conf,
const set &changed) {
if (changed.count("rbd_mirror_concurrent_image_syncs")) {
- set_max_concurrent_syncs(conf->rbd_mirror_concurrent_image_syncs);
+ set_max_concurrent_syncs(conf->get_val("rbd_mirror_concurrent_image_syncs"));
}
}
diff --git a/src/tools/rbd_mirror/InstanceReplayer.cc b/src/tools/rbd_mirror/InstanceReplayer.cc
index 52e60605c758e..8b7fca17ac16e 100644
--- a/src/tools/rbd_mirror/InstanceReplayer.cc
+++ b/src/tools/rbd_mirror/InstanceReplayer.cc
@@ -483,7 +483,8 @@ void InstanceReplayer::schedule_image_state_check_task() {
queue_start_image_replayers();
});
- int after = g_ceph_context->_conf->rbd_mirror_image_state_check_interval;
+ int after = g_ceph_context->_conf->get_val(
+ "rbd_mirror_image_state_check_interval");
dout(20) << "scheduling image state check after " << after << " sec (task "
<< m_image_state_check_task << ")" << dendl;
diff --git a/src/tools/rbd_mirror/InstanceWatcher.cc b/src/tools/rbd_mirror/InstanceWatcher.cc
index 0c82c3007fc73..7f94976ea1c60 100644
--- a/src/tools/rbd_mirror/InstanceWatcher.cc
+++ b/src/tools/rbd_mirror/InstanceWatcher.cc
@@ -326,7 +326,7 @@ InstanceWatcher::InstanceWatcher(librados::IoCtx &io_ctx,
m_lock(unique_lock_name("rbd::mirror::InstanceWatcher::m_lock", this)),
m_instance_lock(librbd::ManagedLock::create(
m_ioctx, m_work_queue, m_oid, this, librbd::managed_lock::EXCLUSIVE, true,
- m_cct->_conf->rbd_blacklist_expire_seconds)) {
+ m_cct->_conf->get_val("rbd_blacklist_expire_seconds"))) {
}
template
diff --git a/src/tools/rbd_mirror/Instances.cc b/src/tools/rbd_mirror/Instances.cc
index 302700e51bb61..56feb760ae3fb 100644
--- a/src/tools/rbd_mirror/Instances.cc
+++ b/src/tools/rbd_mirror/Instances.cc
@@ -228,9 +228,9 @@ void Instances::schedule_remove_task(Instance &instance) {
cancel_remove_task(instance);
- int after = m_cct->_conf->rbd_mirror_leader_heartbeat_interval *
- (1 + m_cct->_conf->rbd_mirror_leader_max_missed_heartbeats +
- m_cct->_conf->rbd_mirror_leader_max_acquire_attempts_before_break);
+ int after = m_cct->_conf->get_val("rbd_mirror_leader_heartbeat_interval") *
+ (1 + m_cct->_conf->get_val("rbd_mirror_leader_max_missed_heartbeats") +
+ m_cct->_conf->get_val("rbd_mirror_leader_max_acquire_attempts_before_break"));
instance.timer_task = new FunctionContext(
[this, &instance](int r) {
diff --git a/src/tools/rbd_mirror/LeaderWatcher.cc b/src/tools/rbd_mirror/LeaderWatcher.cc
index 9e99d6b6f6e8b..46f555252f0e4 100644
--- a/src/tools/rbd_mirror/LeaderWatcher.cc
+++ b/src/tools/rbd_mirror/LeaderWatcher.cc
@@ -33,7 +33,8 @@ LeaderWatcher::LeaderWatcher(Threads *threads, librados::IoCtx &io_ctx,
m_lock("rbd::mirror::LeaderWatcher " + io_ctx.get_pool_name()),
m_notifier_id(librados::Rados(io_ctx).get_instance_id()),
m_leader_lock(new LeaderLock(m_ioctx, m_work_queue, m_oid, this, true,
- m_cct->_conf->rbd_blacklist_expire_seconds)) {
+ m_cct->_conf->get_val(
+ "rbd_blacklist_expire_seconds"))) {
}
template
@@ -370,7 +371,8 @@ void LeaderWatcher::schedule_timer_task(const std::string &name,
m_timer_gate->timer_callback = timer_callback;
});
- int after = delay_factor * m_cct->_conf->rbd_mirror_leader_heartbeat_interval;
+ int after = delay_factor * m_cct->_conf->get_val(
+ "rbd_mirror_leader_heartbeat_interval");
dout(20) << "scheduling " << name << " after " << after << " sec (task "
<< m_timer_task << ")" << dendl;
@@ -567,8 +569,8 @@ void LeaderWatcher::handle_get_locker(int r,
}
}
- if (m_acquire_attempts >=
- m_cct->_conf->rbd_mirror_leader_max_acquire_attempts_before_break) {
+ if (m_acquire_attempts >= m_cct->_conf->get_val(
+ "rbd_mirror_leader_max_acquire_attempts_before_break")) {
dout(0) << "breaking leader lock after " << m_acquire_attempts << " "
<< "failed attempts to acquire" << dendl;
break_leader_lock();
@@ -604,7 +606,7 @@ void LeaderWatcher::schedule_acquire_leader_lock(uint32_t delay_factor) {
schedule_timer_task("acquire leader lock",
delay_factor *
- m_cct->_conf->rbd_mirror_leader_max_missed_heartbeats,
+ m_cct->_conf->get_val("rbd_mirror_leader_max_missed_heartbeats"),
false, &LeaderWatcher::acquire_leader_lock, false);
}
diff --git a/src/tools/rbd_mirror/Mirror.cc b/src/tools/rbd_mirror/Mirror.cc
index b4509d5c465d5..61dc9bf2d89c7 100644
--- a/src/tools/rbd_mirror/Mirror.cc
+++ b/src/tools/rbd_mirror/Mirror.cc
@@ -264,7 +264,7 @@ void Mirror::run()
}
m_cond.WaitInterval(
m_lock,
- utime_t(m_cct->_conf->rbd_mirror_pool_replayers_refresh_interval, 0));
+ utime_t(m_cct->_conf->get_val("rbd_mirror_pool_replayers_refresh_interval"), 0));
}
// stop all pool replayers in parallel
diff --git a/src/tools/rbd_mirror/PoolReplayer.cc b/src/tools/rbd_mirror/PoolReplayer.cc
index 6c3b228dd58aa..8d03e878f16c8 100644
--- a/src/tools/rbd_mirror/PoolReplayer.cc
+++ b/src/tools/rbd_mirror/PoolReplayer.cc
@@ -513,10 +513,10 @@ void PoolReplayer::print_status(Formatter *f, stringstream *ss)
f->dump_string("local_cluster_admin_socket",
reinterpret_cast(m_local_io_ctx.cct())->_conf->
- admin_socket);
+ get_val("admin_socket"));
f->dump_string("remote_cluster_admin_socket",
reinterpret_cast(m_remote_io_ctx.cct())->_conf->
- admin_socket);
+ get_val("admin_socket"));
f->open_object_section("sync_throttler");
m_instance_watcher->print_sync_status(f, ss);
diff --git a/src/tools/rbd_mirror/Threads.cc b/src/tools/rbd_mirror/Threads.cc
index 8c22440a00671..45a6fddd6fdd5 100644
--- a/src/tools/rbd_mirror/Threads.cc
+++ b/src/tools/rbd_mirror/Threads.cc
@@ -12,11 +12,13 @@ namespace mirror {
template
Threads::Threads(CephContext *cct) : timer_lock("Threads::timer_lock") {
thread_pool = new ThreadPool(cct, "Journaler::thread_pool", "tp_journal",
- cct->_conf->rbd_op_threads, "rbd_op_threads");
+ cct->_conf->get_val("rbd_op_threads"),
+ "rbd_op_threads");
thread_pool->start();
work_queue = new ContextWQ("Journaler::work_queue",
- cct->_conf->rbd_op_thread_timeout, thread_pool);
+ cct->_conf->get_val("rbd_op_thread_timeout"),
+ thread_pool);
timer = new SafeTimer(cct, timer_lock, true);
timer->init();
diff --git a/src/tools/rbd_mirror/image_sync/ImageCopyRequest.cc b/src/tools/rbd_mirror/image_sync/ImageCopyRequest.cc
index dbc2560acd025..6278d01015558 100644
--- a/src/tools/rbd_mirror/image_sync/ImageCopyRequest.cc
+++ b/src/tools/rbd_mirror/image_sync/ImageCopyRequest.cc
@@ -39,7 +39,8 @@ ImageCopyRequest::ImageCopyRequest(I *local_image_ctx, I *remote_image_ctx,
m_progress_ctx(progress_ctx),
m_lock(unique_lock_name("ImageCopyRequest::m_lock", this)),
m_updating_sync_point(false), m_update_sync_ctx(nullptr),
- m_update_sync_point_interval(m_local_image_ctx->cct->_conf->rbd_mirror_sync_point_update_age),
+ m_update_sync_point_interval(m_local_image_ctx->cct->_conf->template get_val(
+ "rbd_mirror_sync_point_update_age")),
m_client_meta_copy(*client_meta) {
assert(!m_client_meta_copy.sync_points.empty());
}
@@ -142,7 +143,7 @@ void ImageCopyRequest::send_object_copies() {
bool complete;
{
Mutex::Locker locker(m_lock);
- for (int i = 0; i < cct->_conf->rbd_concurrent_management_ops; ++i) {
+ for (int i = 0; i < cct->_conf->get_val("rbd_concurrent_management_ops"); ++i) {
send_next_object_copy();
if (m_ret_val < 0 && m_current_ops == 0) {
break;
diff --git a/src/tools/rbd_nbd/rbd-nbd.cc b/src/tools/rbd_nbd/rbd-nbd.cc
index a3d3577310ccf..52b16230f1a30 100644
--- a/src/tools/rbd_nbd/rbd-nbd.cc
+++ b/src/tools/rbd_nbd/rbd-nbd.cc
@@ -931,7 +931,7 @@ static int parse_args(vector& args, std::ostream *err_msg, Config *
config.parse_config_files(nullptr, nullptr, 0);
config.parse_env();
config.parse_argv(args);
- cfg->poolname = config.rbd_default_pool;
+ cfg->poolname = config.get_val("rbd_default_pool");
for (i = args.begin(); i != args.end(); ) {
if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {