summaryrefslogtreecommitdiffstats
path: root/src/common/ceph_context.cc (follow)
Commit message (Collapse)AuthorAgeFilesLines
* common/ceph_context: hardwire module_type to CEPH_ENTITY_TYPE_OSDKefu Chai2019-02-121-1/+1
| | | | | | currently, crimson project is only targeting crimson-osd. Signed-off-by: Kefu Chai <kchai@redhat.com>
* common/ceph_context: get_moduel_type() for seastar cctSage Weil2019-02-071-0/+5
| | | | Signed-off-by: Sage Weil <sage@redhat.com>
* wherever: guard handle_conf_change() from concurrent executionVenky Shankar2018-12-131-3/+13
| | | | | Fixes: http://tracker.ceph.com/issues/24823 Signed-off-by: Venky Shankar <vshankar@redhat.com>
* common: std::lock_guard<...> -> std::lock_guardSage Weil2018-11-211-4/+4
| | | | Signed-off-by: Sage Weil <sage@redhat.com>
* common/ceph_context: Mutex -> ceph::mutexSage Weil2018-11-211-13/+13
| | | | Signed-off-by: Sage Weil <sage@redhat.com>
* Merge pull request #24141 from liu-chunmei/ceph_seastar_perfcounterKefu Chai2018-11-151-3/+5
|\ | | | | | | | | common,crimson: port perfcounters to seastar Reviewed-by: Kefu Chai <kchai@redhat.com>
| * crimson:port perfcounters to seastarchunmei Liu2018-10-301-2/+3
| | | | | | | | | | | | | | | | reuse PerfCounterCollectionImpl to port it to seastar. create shard service for perfcounters, each seastar thread has its own perfcounterscollection and perfcunters m_loggers. Signed-off-by: chunmei Liu <chunmei.liu@intel.com>
| * common: move lock out of PerfCounterCollection and rename itchunmei Liu2018-10-301-1/+2
| | | | | | | | | | | | | | | | extract PerfCounterCollectionImpl and move m_lock out from perfcounters.cc to upper,then seastar osd can reuse functions in perfcounters.cc. Signed-off-by: chunmei Liu <chunmei.liu@intel.com>
* | common/ceph_context: add perf counters for all mempoolsSage Weil2018-10-291-0/+38
| | | | | | | | | | | | Report bytes and items for each mempool. Signed-off-by: Sage Weil <sage@redhat.com>
* | common/ceph_common: add heartbeat perf counters unconditionallySage Weil2018-10-291-18/+23
|/ | | | | | | | | | | | | rgw and rbd_mirror were enabling a perfcounter monitoring the heartbeatmap. Enable this unconditionally for all ccts. This is simpler and more useful! Add a CINIT_FLAG to avoid starting them up. This is only used by the unit tests which do not expect all the cct crap and we don't want to break every time we add a new cct counter. That means removing the CephContextPerfCounters test. Signed-off-by: Sage Weil <sage@redhat.com>
* common: Mutex::Locker -> std::lock_guard<Mutex>Sage Weil2018-09-201-3/+3
| | | | Signed-off-by: Sage Weil <sage@redhat.com>
* common: specialize for WITH_SEASTARKefu Chai2018-09-061-0/+35
| | | | | | | | | | | | * define a specialized version CephContext for WITH_SEASTAR. this CephContext exposes the minimal set of interface for ceph::mon::Client * do not include unused stuff defined in common_init.cc, as it introduces more compile-time dependencies we need to prepare to appease the compiler. * implement g_conf() for WITH_SEASTAR, so it returns ceph::common::local_conf() if WITH_SEASTAR is defined. Signed-off-by: Kefu Chai <kchai@redhat.com>
* common: catch cmd_bad_getSage Weil2018-09-011-1/+5
| | | | Signed-off-by: Sage Weil <sage@redhat.com>
* cleanup: Replace always-false assertions with abortAdam C. Emerson2018-08-271-5/+3
| | | | Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* common: Call ceph_abort(), not abort()Adam C. Emerson2018-08-271-1/+1
| | | | Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* common: Use ceph_assert for assertsAdam C. Emerson2018-08-271-5/+5
| | | | Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* common: move ConfigValues out of md_config_tKefu Chai2018-07-101-8/+6
| | | | | | | | | | | | by moving ConfigValues out of md_config_t, we are able to point md_config_t to a new ConfigValues instance at runtime, without destroying the old one. also remove ConfigReader, because all md_config_obs_t will be updated with ConfigProxy now. as md_config_t is not able to offer the *data* anymore. Signed-off-by: Kefu Chai <kchai@redhat.com>
* common,rbd,rgw,osd: extract config values into ConfigValuesKefu Chai2018-07-101-31/+31
| | | | | | | | | | | | | | | | | | | | | | | | | this change introduce three classes: ConfigValues, ConfigProxy and ConfigReader. in seastar port of OSD, each CPU shard will hold its own reference of configuration, and upon changes of settings, each shard will be updated with the new setting in async. so this forces us to be able to keep two set of configuration at the same time. so we need to extract the changeable part of md_config_t out. so we can replace the old one with new one on demand, and let different shards share the same unchanged part, amon the other things, the Options map and the lookup tables. that's why we need ConfigValues. we will add a policy template for this class, so we can specialize for Seastar implementation to allow different ConfigProxy instances to point md_config_impl<> to different ConfigValues. because the observer interface is still using md_config_t, to minimise the impact of this change, handle_conf_change() and handle_subsys_change() are not changed. but as it accepts a `const md_config_t`, which cannot be used to create/reference the ConfigProxy holding it, we need to introduce ConfigReader for reading the updated setting from md_config_t in a simpler way, without exposing the internal "values" member variable. Signed-off-by: Kefu Chai <kchai@redhat.com>
* common: add LockPolicy to md_config_tKefu Chai2018-06-271-0/+2
| | | | | | | | | before this change, we guard all read/write access to md_config_t with a lock. after this change, this policy is optional. and is controled by a enum named `LockPolicy`. we will use `md_config_impl<LockPolicy::SINGLE>` to implement the lockless config used by crimson/osd. Signed-off-by: Kefu Chai <kchai@redhat.com>
* common/ceph_context: add "assert" and "abort" asok commandsSage Weil2018-06-201-0/+8
| | | | | | Require 'debug_asok_assert_abort = true' Signed-off-by: Sage Weil <sage@redhat.com>
* osd,mds,common: make 'config rm ...' idempotentSage Weil2018-06-041-1/+1
| | | | | Fixes: http://tracker.ceph.com/issues/24408 Signed-off-by: Sage Weil <sage@redhat.com>
* common/admin_socket: add new api unregister_commands(AdminSocketHook *hook)Jianpeng Ma2018-05-051-19/+1
| | | | | | | We can unregister all commands which belong to this hook. Make code looks clean and avoid forgeting unregister command. Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
* common/ceph_context: implement 'config unset <var>'Sage Weil2018-03-061-0/+19
| | | | | | | Clear an override value (if any). This works for 'ceph daemon ...' asok commands. Signed-off-by: Sage Weil <sage@redhat.com>
* common/options: fix dump()Sage Weil2018-03-061-2/+2
| | | | | | By convention dump() does not include the containing object section. Signed-off-by: Sage Weil <sage@redhat.com>
* common/ceph_context: count crypto/shutdown cyclesSage Weil2018-03-061-5/+14
| | | | | | | We need to allow crypto to be set up and torn down before a fork. Count the init/shutdown cycles to make that safe. Signed-off-by: Sage Weil <sage@redhat.com>
* common/ceph_context: whitespaceSage Weil2018-03-061-7/+6
| | | | Signed-off-by: Sage Weil <sage@redhat.com>
* common/config: rewrite (╯°□°)╯︵ ┻━┻Sage Weil2018-03-061-56/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is too complete a rewrite to reasonably break down into small steps, and even if I could, it would be harder to review that way than to simply review the new implementation. The semantics of the old one were so weird that it's harder to reason about the change in behavior than to simply review the new behavior. That's my story, at least, and I'm sticking to it! So, here are the highlights: - $foo meta expansions are evaluated at get_val() time. This means the weird bool arguments to set_val specifying whether things were expanded are removed (they didn't make any sense unless you were thinking about the old implementation). - for every option, we track values from any inputs (config, mon, override). At get_val() time, we pick the highest priority one. - diff() is rewritten to be simple and to show you all of the above. - internal interfaces are simplified, and in terms of Option::value_t whenever possible. - unit tests simplified somewhat based on the above. Known issues: - legacy values get pushed out in select cases. Notably if foo=$bar and bar is updated, we do not update $foo (there is no dependency tracking to do this efficiently). Signed-off-by: Sage Weil <sage@redhat.com>
* common/ceph_context: mark some singletones as drop-on-forkSage Weil2018-03-041-1/+31
| | | | Signed-off-by: Sage Weil <sage@redhat.com>
* Merge pull request #20273 from adamemerson/wip-any-singleton-will-doKefu Chai2018-02-281-6/+2
|\ | | | | | | | | | | common: Switch singletons to use immobile_any and cleanups Reviewed-by: Jesse Williamson <jwilliamson@suse.de> Reviewed-by: Kefu Chai <kchai@redhat.com>
| * common: Switch singletons to use immobile_anyAdam C. Emerson2018-02-071-6/+2
| | | | | | | | | | | | | | This cleans up the interface, makes things more robust by using both name and type, and does fewer allocations. Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* | common/admin_socket: Use std::mutex/condition_variable/threadAdam C. Emerson2018-02-161-0/+5
| | | | | | | | | | | | | | And fix a bug where we exit in one code-path without releasing the lock. Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* | common/admin_socket: Copy fewer stringsAdam C. Emerson2018-02-161-10/+10
|/ | | | | | | | | | | | | | | | Pass std::string_view to call, rather than passing strings by value. Change cmdmap_t and the maps in admin_socket to use the std::less<> transparent comparator, so we can compare string_views to strings. (Or anything else with an equality operator with strings.) Pass the cmdmap_t in to call by const reference, not reference. The change to cmdmap_t requires changing some of the users of cmdmap_t. (That is, make them actually use cmdmap_t explicitly, not the open-coed map type.) Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* log: add log_stderr_prefix optionSage Weil2017-12-121-0/+5
| | | | | | | Allows you to set a prefix for debug log messages send to stderr (e.g., "debug "). Signed-off-by: Sage Weil <sage@redhat.com>
* common/config: make internal_safe_to_start_threads internalSage Weil2017-11-111-1/+1
| | | | | | | | | There is no reason for this to be exposed like a normal config option (even a legacy one) since it is an internal safety flag. We do keep the clear_() helper there for the unit test. Signed-off-by: Sage Weil <sage@redhat.com>
* Revert "ceph_context: re-expand admin_socket metavariables in child process"Patrick Donnelly2017-10-251-13/+0
| | | | | | | | | This commit introduces a regression where the admin socket specified in ceph.conf overrides command line arguments or environment variables. This reverts commit 1630f4bbef3a3ff6efb56acbaa9b8786b945b1e6. Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* ceph_context: re-expand admin_socket metavariables in child processZhi Zhang2017-10-231-0/+13
| | | | | | | | Reset admin_socket raw value if it is defined in conffile. Just in case it used metavarirables (e.g, $pid) which could be expanded again to the correct value in child process. Signed-off-by: Zhi Zhang <zhangz.david@outlook.com>
* Merge pull request #17972 from cbodley/wip-21401Kefu Chai2017-10-131-0/+1
|\ | | | | | | | | auth: keep /dev/urandom open for get_random_bytes Reviewed-by: Adam Emerson <aemerson@redhat.com>
| * common: add CryptoRandom to CephContextCasey Bodley2017-10-091-0/+1
| | | | | | | | Signed-off-by: Casey Bodley <cbodley@redhat.com>
* | config: Remove _get_valAdam C. Emerson2017-10-101-1/+1
|/ | | | | | | | | I added this originally to prevent a deadlock when reading a new-style configuration variable from a called observer. I didn't realize at the time that the config mutex was recursive, so this change was superfluous. Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* log: Add log_coarse_timestamps optionAdam C. Emerson2017-10-071-0/+5
| | | | | | | And set up an observer in CephContext to coarsen/refine time stamps as requested. Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* mon,monmap: use new style config optsKefu Chai2017-09-071-1/+1
| | | | Signed-off-by: Kefu Chai <kchai@redhat.com>
* osd: migrate to ceph::spinlockJesse Williamson2017-08-111-4/+4
| | | | Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
* common: migrate ceph::Spinlock to ceph::spinlockJesse Williamson2017-08-111-8/+8
| | | | Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
* common: adds ceph::spinlock, removes ceph::SpinlockJesse Williamson2017-08-111-8/+8
| | | | | | | ceph::spinlock models /BasicLockable/, and works with standard library types like std::lock_guard<>. Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
* common: apply ceph::spin_lock_guardJesse Williamson2017-08-111-18/+18
| | | | Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
* common: adds spinlock.h, migrates code; removes Spinlock.hJesse Williamson2017-08-111-30/+25
| | | | Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
* common: use code_environment_t for daemon-ness in configJohn Spray2017-07-241-14/+4
| | | | | | | ...and reinstate the set_daemon_default versions of config options in place of the special casing in common_init. Signed-off-by: John Spray <john.spray@redhat.com>
* common: implement "config help" to output schemaJohn Spray2017-07-211-0/+23
| | | | Signed-off-by: John Spray <john.spray@redhat.com>
* common: respect daemon defaults in config optionsJohn Spray2017-07-211-1/+12
| | | | Signed-off-by: John Spray <john.spray@redhat.com>
* common/ceph_context: s/atomic_t/std::atomic<>/Kefu Chai2017-06-081-1/+2
| | | | Signed-off-by: Kefu Chai <kchai@redhat.com>