From: Kefu Chai Date: Fri, 9 Apr 2021 10:54:46 +0000 (+0800) Subject: common: extract options into yaml X-Git-Tag: v17.1.0~2272^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5ddda38da4f3c8ab8ff9c1a501bcd54df558fb80;p=ceph.git common: extract options into yaml extract the options in common/options.cc into separate .yaml.in files, and preprocess them using CMake before translating them into .cc files using a python script. this change paves the road to render the options using sphinx, and will allow us to further annotate the options to include more metadata. also, a this YAML file can be consumed by applications like dashboard and Sphinx to consume these metadata in a simpler way. * use @variable-name@ for substituting the variables in .yaml.in file * use cmake variable of `mgr_disabled_modules` instead of C macro to define `mgr_disabled_modules` in global.yaml.in * debian/control, ceph.spec.in, win32_deps_build.sh: add python3-yaml as build dep * add y2c.py (short for YAML to C++) to translate .yaml to .cc file * common/options/*.yaml.in: extract and split options into .yaml.in files, the subvars in it is then replaced with CMake variables, and copied to the corresponding .yaml files * include/config-h.in.cmake: remove MGR_DISABLED_MODULES, as it is not a CMake variable. Signed-off-by: Kefu Chai --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f623c5e1b791..b42f82d7c98c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -487,11 +487,6 @@ if(WITH_MGR) set(MGR_PYTHON_LIBRARIES ${Python3_LIBRARIES}) set(MGR_PYTHON_VERSION_MAJOR ${Python3_VERSION_MAJOR}) set(MGR_PYTHON_VERSION_MINOR ${Python3_VERSION_MINOR}) - # https://tracker.ceph.com/issues/45147 - if(Python3_VERSION VERSION_GREATER_EQUAL 3.8) - set(MGR_DISABLED_MODULES "diskprediction_local") - message(STATUS "mgr module disabled for ${Python3_VERSION}: ${MGR_DISABLED_MODULES}") - endif() # Boost dependency check deferred to Boost section endif(WITH_MGR) endif(NOT WIN32) diff --git a/ceph.spec.in b/ceph.spec.in index f363361e1e5e..66e069e5bcda 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -327,6 +327,7 @@ BuildRequires: cunit-devel BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-Cython BuildRequires: python%{python3_pkgversion}-PrettyTable +BuildRequires: python%{python3_pkgversion}-PyYAML BuildRequires: python%{python3_pkgversion}-Sphinx BuildRequires: rdma-core-devel BuildRequires: liblz4-devel >= 1.7 @@ -349,6 +350,7 @@ BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-Cython BuildRequires: python%{python3_pkgversion}-prettytable +BuildRequires: python%{python3_pkgversion}-pyyaml BuildRequires: python%{python3_pkgversion}-sphinx BuildRequires: lz4-devel >= 1.7 %endif diff --git a/debian/control b/debian/control index 1ca1b3b46053..d61dac291a88 100644 --- a/debian/control +++ b/debian/control @@ -98,7 +98,7 @@ Build-Depends: automake, python3-setuptools, python3-sphinx, # Make-Check python3-werkzeug, - python3-setuptools, + python3-yaml, # Crimson ragel, # Make-Check socat, # Crimson systemtap-sdt-dev, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 98db46226bd4..12e8300efaf0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -447,6 +447,7 @@ add_subdirectory(arch) set(ceph_common_objs $ $ + $ $ $ $ diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index a2d50aed896f..2feaa80800d9 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -11,6 +11,8 @@ if(WIN32) add_library(dlfcn_win32 STATIC win32/dlfcn.cc win32/errno.cc) endif() +add_subdirectory(options) + set(common_srcs AsyncOpTracker.cc BackTrace.cc diff --git a/src/common/options.cc b/src/common/options.cc index f2c0104f7d89..5f89980d85a4 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -4,6 +4,7 @@ #include "acconfig.h" #include "options.h" #include "common/Formatter.h" +#include "common/options/build_options.h" // Helpers for validators #include "include/stringify.h" @@ -336,8843 +337,4 @@ void Option::print(ostream *out) const } } -constexpr unsigned long long operator"" _min (unsigned long long min) { - return min * 60; -} -constexpr unsigned long long operator"" _hr (unsigned long long hr) { - return hr * 60 * 60; -} -constexpr unsigned long long operator"" _day (unsigned long long day) { - return day * 24 * 60 * 60; -} -constexpr unsigned long long operator"" _K (unsigned long long n) { - return n << 10; -} -constexpr unsigned long long operator"" _M (unsigned long long n) { - return n << 20; -} -constexpr unsigned long long operator"" _G (unsigned long long n) { - return n << 30; -} -constexpr unsigned long long operator"" _T (unsigned long long n) { - return n << 40; -} - -std::vector