]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: switched from legacy to new-style configuration options 16737/head
authorJason Dillaman <dillaman@redhat.com>
Tue, 1 Aug 2017 19:03:57 +0000 (15:03 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 9 Aug 2017 14:00:02 +0000 (10:00 -0400)
Fixes: http://tracker.ceph.com/issues/20737
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
35 files changed:
src/common/legacy_config_opts.h
src/common/options.cc
src/librbd/ImageCtx.cc
src/librbd/ImageCtx.h
src/librbd/ImageState.cc
src/librbd/ImageWatcher.cc
src/librbd/Journal.cc
src/librbd/image/CreateRequest.cc
src/librbd/internal.cc
src/librbd/io/ImageRequestWQ.cc
src/librbd/operation/ObjectMapIterate.cc
src/test/librbd/journal/test_Entries.cc
src/test/librbd/journal/test_Replay.cc
src/test/librbd/managed_lock/test_mock_AcquireRequest.cc
src/test/librbd/mock/MockImageCtx.h
src/test/librbd/test_internal.cc
src/test/rbd_mirror/test_mock_LeaderWatcher.cc
src/tools/rbd/Utils.cc
src/tools/rbd/action/Export.cc
src/tools/rbd/action/Import.cc
src/tools/rbd/action/Kernel.cc
src/tools/rbd/action/List.cc
src/tools/rbd/action/MirrorPool.cc
src/tools/rbd_mirror/ImageDeleter.cc
src/tools/rbd_mirror/ImageReplayer.cc
src/tools/rbd_mirror/ImageSyncThrottler.cc
src/tools/rbd_mirror/InstanceReplayer.cc
src/tools/rbd_mirror/InstanceWatcher.cc
src/tools/rbd_mirror/Instances.cc
src/tools/rbd_mirror/LeaderWatcher.cc
src/tools/rbd_mirror/Mirror.cc
src/tools/rbd_mirror/PoolReplayer.cc
src/tools/rbd_mirror/Threads.cc
src/tools/rbd_mirror/image_sync/ImageCopyRequest.cc
src/tools/rbd_nbd/rbd-nbd.cc

index 5c28e939207d82b0b28b413525fda84420d5e0c8..7222ef6ca7ea76f47e96c1ecd948b097b2432331 100644 (file)
@@ -1305,110 +1305,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
 
 
index 7b35baf9d2ed18ca72cb16096efebd579f15bc03..68982f1f376c1dad5072478d9c1d97fede0712c8 100644 (file)
@@ -4948,7 +4948,7 @@ static std::vector<Option> get_rbd_options() {
   return std::vector<Option>({
     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)) {
@@ -4960,7 +4960,7 @@ static std::vector<Option> 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)) {
@@ -4972,7 +4972,15 @@ static std::vector<Option> 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<std::string, uint64_t> FEATURE_MAP = {
@@ -5033,234 +5041,241 @@ static std::vector<Option> 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<Option> get_rbd_mirror_options() {
+  return std::vector<Option>({
     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"),
   });
 }
 
@@ -5943,6 +5958,7 @@ static std::vector<Option> 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");
 
index c97b11505d7744e7c8ed6d5e1395d6b1edd5f382..3db79a7ed30c24a2faeefbd9fb4dc60f3081880b 100644 (file)
@@ -60,7 +60,7 @@ public:
     : 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<int64_t>("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<int64_t>("rbd_op_thread_timeout"),
       thread_pool);
 
-    if (cct->_conf->rbd_auto_exclusive_lock_until_manual_request) {
+    if (cct->_conf->get_val<bool>("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<type>("rbd_"#config);                  \
       else                                                                     \
-        config = cct->_conf->rbd_##config;                                     \
+        config = cct->_conf->get_val<type>("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> *ImageCtx::create_exclusive_lock() {
index 2bda521f154230e997d1429fb76da19e04fe7f74..6fcad3c27e9ce69a9dfe92a2cf30713245bd1e27 100644 (file)
@@ -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;
 
index ba4151a0005d6b31da26d90c8d0647a004da54cd..5c2d92a4eedc75b124e2f8b3e7b4df69377a2279 100644 (file)
@@ -216,7 +216,7 @@ private:
     m_cct->lookup_or_create_singleton_object<ThreadPoolSingleton>(
       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<int64_t>("rbd_op_thread_timeout"),
                                 thread_pool_singleton);
   }
 
index ca612a9ded86a4278b439b5175d2f4ff8d7bbc42..487eabaa69c18f5c7b374362982ce071b40de1b2 100644 (file)
@@ -425,7 +425,8 @@ void ImageWatcher<I>::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<int64_t>(
+      "client_notify_timeout");
     ldout(m_image_ctx.cct, 15) << this << " will retry in " << retry_timeout
                                << " seconds" << dendl;
     schedule_request_lock(true, retry_timeout);
index aa73cdeddac73c45ffd15307a5c5430694aca329..9fe57cd3f7b87874f619fdf259023d6c37ba22d7 100644 (file)
@@ -337,7 +337,7 @@ Journal<I>::Journal(I &image_ctx)
   cct->lookup_or_create_singleton_object<ThreadPoolSingleton>(
     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<int64_t>("rbd_op_thread_timeout"),
                                thread_pool_singleton);
   ImageCtx::get_timer_instance(cct, &m_timer, &m_timer_lock);
 }
index f7376db9a85e6a21105918a950f4d4e68486f87c..9f43ebc6a2e607214f3a37bafc2e477285f2972c 100644 (file)
@@ -164,29 +164,29 @@ CreateRequest<I>::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<uint64_t>("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<uint64_t>("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<int64_t>("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<uint64_t>("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<uint64_t>("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<std::string>("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<std::string>("rbd_default_data_pool");
   }
 
   m_layout.object_size = 1ull << m_order;
@@ -268,7 +268,7 @@ void CreateRequest<I>::send() {
 
 template<typename I>
 void CreateRequest<I>::validate_pool() {
-  if (!m_cct->_conf->rbd_validate_pool) {
+  if (!m_cct->_conf->get_val<bool>("rbd_validate_pool")) {
     create_id_object();
     return;
   }
index 70c706c6d4beec42e45430c0e2f894f157ad6363..3198a5c3a9cad4b99e179dc6aa4cdc0e3c1cb270 100644 (file)
@@ -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<bool>("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<int64_t>("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<int64_t>("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);
     }
 
index 4cc8e0148dd19ab1d57825abb0df9c000b602c7b..81800cc4ae73cf904fb245ce98c91b83a1f210e9 100644 (file)
@@ -200,7 +200,7 @@ void ImageRequestWQ<I>::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<I>::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<I>::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 <typename I>
 void ImageRequestWQ<I>::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<I>::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<I>::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");
   }
index 35119e0f5cd2dc3e91ef5eed5cda288f28154c69..1e4b854bddd500f8e0ff7d77427ee42d3c2aab0e 100644 (file)
@@ -256,7 +256,7 @@ void ObjectMapIterateRequest<I>::send_verify_objects() {
   AsyncObjectThrottle<I> *throttle = new AsyncObjectThrottle<I>(
     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 <typename I>
index 33e162a0f5e6324963080fce7accc2ba75d7dde9..54be1487faed851a2472e30aa7566ab1b57e7e88 100644 (file)
@@ -164,7 +164,7 @@ TEST_F(TestJournalEntries, AioDiscard) {
   REQUIRE_FEATURE(RBD_FEATURE_JOURNALING);
 
   CephContext* cct = reinterpret_cast<CephContext*>(_rados.cct());
-  REQUIRE(!cct->_conf->rbd_skip_partial_discard);
+  REQUIRE(!cct->_conf->get_val<bool>("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();
 
index 7c735695b8e89fae73fbcbbeaf5ac3e555318e73..d8c651858a822f9d58999825fcf14858ad1242c9 100644 (file)
@@ -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();
 }
index 174e97be49bf8e8a88c71d33ee3d9ffc1e6ef48a..8f2f5f6ef2774bf5566e195e473358a5e1008a58 100644 (file)
@@ -34,8 +34,9 @@ struct BreakRequest<librbd::MockImageCtx> {
                               uint32_t blacklist_expire_seconds,
                               bool force_break_lock, Context *on_finish) {
     CephContext *cct = reinterpret_cast<CephContext *>(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<bool>("rbd_blacklist_on_break_lock"),
+              blacklist_locker);
+    EXPECT_EQ(cct->_conf->get_val<int64_t>("rbd_blacklist_expire_seconds"),
               (int)blacklist_expire_seconds);
     EXPECT_FALSE(force_break_lock);
     assert(s_instance != nullptr);
index 483b063e56f330a75c793f43013788ab3cc9d1f6..be439b985f722badaf5b2abcded7ffb0c57f80a6 100644 (file)
@@ -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
index dd8d5a8cb0c63ca383fc836e2276bc21190bbc27..7cc6e12cab9b9ac0c5d07e88f0322f893d6627e2 100644 (file)
@@ -718,7 +718,7 @@ TEST_F(TestInternal, DiscardCopyup)
   REQUIRE_FEATURE(RBD_FEATURE_LAYERING);
 
   CephContext* cct = reinterpret_cast<CephContext*>(_rados.cct());
-  REQUIRE(!cct->_conf->rbd_skip_partial_discard);
+  REQUIRE(!cct->_conf->get_val<bool>("rbd_skip_partial_discard"));
 
   m_image_name = get_temp_image_name();
   m_image_size = 1 << 14;
index 2f458e6ad6411ddd5713193a3e2b356329cae104..2141a00f7a01d3d9df43240a5dca228b155056ba 100644 (file)
@@ -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<CephContext *>(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<int64_t>(
+    "rbd_mirror_leader_max_acquire_attempts_before_break");
 
   MockManagedLock mock_managed_lock;
   MockMirrorStatusWatcher mock_mirror_status_watcher;
index db248e34a1b723072c71abefb9426bb413d102cf..69e34b738ab62bac27496aa0fdf089f552e68205 100644 (file)
@@ -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<bool>("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<std::string>("rbd_default_pool");
 }
 
 std::string get_pool_name(const po::variables_map &vm, size_t *arg_index) {
index 708663a43104f3cc0cb3c9fdf2a4936449e8b0cd..bfda6980598a6190c8ec07caf88fde771b26c0ce 100644 (file)
@@ -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<int64_t>("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<int64_t>("rbd_concurrent_management_ops");
     fd = open(path, O_WRONLY | O_CREAT | O_EXCL, 0644);
     if (fd < 0) {
       return -errno;
index 0f31d810394bee1a8071142ca62605657265d63d..3c717855270574547b92b5b300aa2b0d37590cac 100644 (file)
@@ -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<int64_t>("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<int64_t>("rbd_concurrent_management_ops"), false));
   }
 
   reqlen = min<uint64_t>(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<int64_t>("rbd_default_order");
   }
 
   // try to fill whole imgblklen blocks for sparsification
index 1f1951fc8842539b269ca3d2b00d80d4bff87623..4f58cc27d83c87dabc7219a8529a782f96dbc3a5 100644 (file)
@@ -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<std::string>(
+    "rbd_default_map_options").c_str());
   BOOST_SCOPE_EXIT( (default_map_options) ) {
     free(default_map_options);
   } BOOST_SCOPE_EXIT_END;
index 4c4babe99489d57a057046cc358603da7e55ad0e..fbac3e106559190dd7d1aa6641e0c4e02c198cc3 100644 (file)
@@ -290,7 +290,9 @@ int execute(const po::variables_map &vm) {
     return r;
   }
 
-  r = do_list(pool_name, vm["long"].as<bool>(), g_conf->rbd_concurrent_management_ops, formatter.get());
+  r = do_list(pool_name, vm["long"].as<bool>(),
+              g_conf->get_val<int64_t>("rbd_concurrent_management_ops"),
+              formatter.get());
   if (r < 0) {
     std::cerr << "rbd: list: " << cpp_strerror(r) << std::endl;
     return r;
index 0090a42060b9716886e73eb57b482ab2ba64e4fc..4314b1ed6b46ddc3c8b8944a359414d24dda0422 100644 (file)
@@ -459,7 +459,8 @@ public:
       m_factory(std::bind(ImageRequestAllocator<RequestT>(),
                           std::ref(m_io_ctx), std::ref(m_throttle),
                           std::placeholders::_1, std::forward<Args>(args)...)),
-      m_throttle(g_conf->rbd_concurrent_management_ops, true) {
+      m_throttle(g_conf->get_val<int64_t>("rbd_concurrent_management_ops"),
+                 true) {
   }
 
   int execute() {
index 07de6e93c38cf575d41cd2a3b3f4fd86d0f17aca..333d11e06e494c8e5bfd0953b62ed548ecaa13d0 100644 (file)
@@ -147,7 +147,8 @@ ImageDeleter<I>::ImageDeleter(ContextWQ *work_queue, SafeTimer *timer,
     m_failed_timer_lock(timer_lock),
     m_asok_hook(new ImageDeleterAdminSocketHook<I>(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<double>(
+    "rbd_mirror_delete_retry_interval"));
   m_image_deleter_thread.create("image_deleter");
 }
 
index a84199968a253657c44be60dc252ba242bfa6a3d..2bb31b4b11dabc857ae61efbef2968390294cfcf 100644 (file)
@@ -526,8 +526,10 @@ void ImageReplayer<I>::bootstrap() {
 
   CephContext *cct = static_cast<CephContext *>(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<double>(
+    "rbd_mirror_journal_commit_age");
+  settings.max_fetch_bytes = cct->_conf->get_val<uint64_t>(
+    "rbd_mirror_journal_max_fetch_bytes");
 
   m_remote_journaler = new Journaler(m_threads->work_queue,
                                      m_threads->timer,
@@ -717,7 +719,8 @@ void ImageReplayer<I>::handle_start_replay(int r) {
 
   {
     CephContext *cct = static_cast<CephContext *>(m_local->cct());
-    double poll_seconds = cct->_conf->rbd_mirror_journal_poll_age;
+    double poll_seconds = cct->_conf->get_val<double>(
+      "rbd_mirror_journal_poll_age");
 
     Mutex::Locker locker(m_lock);
     m_replay_handler = new ReplayHandler<I>(this);
index e5d08cea5f48e8203e450878e2946a836ad44d49..dfa96ed4d3e463f3a21faca658958aa54398e99f 100644 (file)
@@ -31,8 +31,8 @@ template <typename I>
 ImageSyncThrottler<I>::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<uint64_t>(
+      "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 <typename I>
 void ImageSyncThrottler<I>::handle_conf_change(const struct md_config_t *conf,
                                       const set<string> &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<uint64_t>("rbd_mirror_concurrent_image_syncs"));
   }
 }
 
index 097007231badf803344298aa0c3710977ff20d87..4adec7c1b77794e54e8e01a97b70048684ce84f0 100644 (file)
@@ -483,7 +483,8 @@ void InstanceReplayer<I>::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<int64_t>(
+    "rbd_mirror_image_state_check_interval");
 
   dout(20) << "scheduling image state check after " << after << " sec (task "
            << m_image_state_check_task << ")" << dendl;
index 0c82c3007fc73f4af29ba3a5dd27d536799a3572..7f94976ea1c60d8ce7cad511505ab95a316f25af 100644 (file)
@@ -326,7 +326,7 @@ InstanceWatcher<I>::InstanceWatcher(librados::IoCtx &io_ctx,
     m_lock(unique_lock_name("rbd::mirror::InstanceWatcher::m_lock", this)),
     m_instance_lock(librbd::ManagedLock<I>::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<int64_t>("rbd_blacklist_expire_seconds"))) {
 }
 
 template <typename I>
index 302700e51bb618d850553f382489b713acc1d419..56feb760ae3fb6d63df431c188b2dcc63f7cb0d8 100644 (file)
@@ -228,9 +228,9 @@ void Instances<I>::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<int64_t>("rbd_mirror_leader_heartbeat_interval") *
+    (1 + m_cct->_conf->get_val<int64_t>("rbd_mirror_leader_max_missed_heartbeats") +
+     m_cct->_conf->get_val<int64_t>("rbd_mirror_leader_max_acquire_attempts_before_break"));
 
   instance.timer_task = new FunctionContext(
     [this, &instance](int r) {
index 9e99d6b6f6e8beb96c2b1b68f2fef9c83716c874..46f555252f0e48e0c7e6dcdfc61479058fc74066 100644 (file)
@@ -33,7 +33,8 @@ LeaderWatcher<I>::LeaderWatcher(Threads<I> *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<int64_t>(
+                                   "rbd_blacklist_expire_seconds"))) {
 }
 
 template <typename I>
@@ -370,7 +371,8 @@ void LeaderWatcher<I>::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<int64_t>(
+    "rbd_mirror_leader_heartbeat_interval");
 
   dout(20) << "scheduling " << name << " after " << after << " sec (task "
            << m_timer_task << ")" << dendl;
@@ -567,8 +569,8 @@ void LeaderWatcher<I>::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<int64_t>(
+        "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<I>::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<int64_t>("rbd_mirror_leader_max_missed_heartbeats"),
                       false, &LeaderWatcher<I>::acquire_leader_lock, false);
 }
 
index b4509d5c465d5cb725aa9d2e3ab4a4a1c51bd9fc..61dc9bf2d89c7615ac4a148949ebc24a8bb9904c 100644 (file)
@@ -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<int64_t>("rbd_mirror_pool_replayers_refresh_interval"), 0));
   }
 
   // stop all pool replayers in parallel
index 6c3b228dd58aa55a8e2e090ca42f44542a2f6810..8d03e878f16c80a3421c90742fdf31b363767a69 100644 (file)
@@ -513,10 +513,10 @@ void PoolReplayer::print_status(Formatter *f, stringstream *ss)
 
   f->dump_string("local_cluster_admin_socket",
                  reinterpret_cast<CephContext *>(m_local_io_ctx.cct())->_conf->
-                     admin_socket);
+                     get_val<std::string>("admin_socket"));
   f->dump_string("remote_cluster_admin_socket",
                  reinterpret_cast<CephContext *>(m_remote_io_ctx.cct())->_conf->
-                     admin_socket);
+                     get_val<std::string>("admin_socket"));
 
   f->open_object_section("sync_throttler");
   m_instance_watcher->print_sync_status(f, ss);
index 8c22440a006718c6d9c56afdc93282f1c05c2b9d..45a6fddd6fdd568140910fbfd01ba45f9d19a7d0 100644 (file)
@@ -12,11 +12,13 @@ namespace mirror {
 template <typename I>
 Threads<I>::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<int64_t>("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<int64_t>("rbd_op_thread_timeout"),
+                             thread_pool);
 
   timer = new SafeTimer(cct, timer_lock, true);
   timer->init();
index dbc2560acd0254188d9809f459d4599d017ad0f6..6278d01015558868bf4dad1ba1b3cc98428cdee1 100644 (file)
@@ -39,7 +39,8 @@ ImageCopyRequest<I>::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<double>(
+      "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<I>::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<int64_t>("rbd_concurrent_management_ops"); ++i) {
       send_next_object_copy();
       if (m_ret_val < 0 && m_current_ops == 0) {
         break;
index a3d3577310ccfe78e83157f0df03147936f14d0d..52b16230f1a30d026b54ec65a5d8d561893e6305 100644 (file)
@@ -931,7 +931,7 @@ static int parse_args(vector<const char*>& 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<std::string>("rbd_default_pool");
 
   for (i = args.begin(); i != args.end(); ) {
     if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {