From: Kefu Chai Date: Thu, 10 Dec 2020 06:17:07 +0000 (+0800) Subject: src/*: do not pass cct to ceph_version_to_str() X-Git-Tag: v17.0.0~337^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=1f5406a752724b55b4fc6c1641d72e3d9c3ba74d;p=ceph.git src/*: do not pass cct to ceph_version_to_str() in e5b1ae5554c4d8a20f9f0ff562b231ad0b0ba0ab, a new option named "debug_version_for_testing" is introduced to override the version so we can test version check. in crimson, we have two families of shared functions. - one of them is used by alien store. they are compiled with -DWITH_SEASTAR and -DWITH_ALIEN, to enable the shim code between seastar and POSIX thread. - another is used by crimson in general. where no lock is allowed. currently, we use the "crimson" and "ceph" namespace to differentiate these two families of functions, so they can colocate in the same executable without violating the ODR. see src/include/common_fwd.h for more details. the functions defined in src/common/version.cc are also shared by alien store and crimson code. and because we have different implementations of `CephContext` in crimson and in classic OSD (i.e. alienstore), we have to have different implementations of this function as well, if we follow the same approach. but since these functions are very simple and are non-blocking, there is not much value in differentiating them, it is better to inject the test settings using environment variable instead of using ceph option subsystem. in this change, "ceph_debug_version_for_testing" environment variable is checked instead, so that crimson and alienstore can share the same compilation unit of version.cc. and "debug_version_for_testing" option is removed. Signed-off-by: Kefu Chai --- diff --git a/qa/standalone/misc/ver-health.sh b/qa/standalone/misc/ver-health.sh index 80d0b690494ba..3c480b2b10533 100755 --- a/qa/standalone/misc/ver-health.sh +++ b/qa/standalone/misc/ver-health.sh @@ -85,7 +85,7 @@ function TEST_check_version_health_1() { ceph health detail | grep DAEMON_OLD_VERSION && return 1 kill_daemons $dir KILL osd.1 - EXTRA_OPTS=" --debug_version_for_testing=01.00.00-gversion-test" activate_osd $dir 1 + ceph_debug_version_for_testing=01.00.00-gversion-test activate_osd $dir 1 wait_for_health_string "HEALTH_WARN .*There is a daemon running an older version of ceph" || return 1 @@ -96,9 +96,9 @@ function TEST_check_version_health_1() { ceph health detail | grep -q "osd.1 is running an older version of ceph: 01.00.00-gversion-test" || return 1 kill_daemons $dir KILL osd.2 - EXTRA_OPTS=" --debug_version_for_testing=01.00.00-gversion-test" activate_osd $dir 2 + ceph_debug_version_for_testing=01.00.00-gversion-test activate_osd $dir 2 kill_daemons $dir KILL osd.0 - EXTRA_OPTS=" --debug_version_for_testing=02.00.00-gversion-test" activate_osd $dir 0 + ceph_debug_version_for_testing=02.00.00-gversion-test activate_osd $dir 0 wait_for_health_string "HEALTH_ERR .*There are daemons running multiple old versions of ceph" || return 1 @@ -135,12 +135,12 @@ function TEST_check_version_health_2() { ceph health detail | grep DAEMON_OLD_VERSION && return 1 kill_daemons $dir KILL mon.b - EXTRA_OPTS=" --debug_version_for_testing=01.00.00-gversion-test" run_mon $dir b --mon_warn_older_version_delay=0.0 + ceph_debug_version_for_testing=01.00.00-gversion-test run_mon $dir b --mon_warn_older_version_delay=0.0 # XXX: Manager doesn't seem to use the test specific config for version #kill_daemons $dir KILL mgr.x - #EXTRA_OPTS=" --debug_version_for_testing=02.00.00-gversion-test" run_mgr $dir x + #ceph_debug_version_for_testing=02.00.00-gversion-test run_mgr $dir x kill_daemons $dir KILL mds.m - EXTRA_OPTS=" --debug_version_for_testing=01.00.00-gversion-test" run_mds $dir m + ceph_debug_version_for_testing=01.00.00-gversion-test run_mds $dir m wait_for_health_string "HEALTH_WARN .*There are daemons running an older version of ceph" || return 1 @@ -151,9 +151,9 @@ function TEST_check_version_health_2() { ceph health detail | grep -q "mon.b mds.m are running an older version of ceph: 01.00.00-gversion-test" || return 1 kill_daemons $dir KILL osd.2 - EXTRA_OPTS=" --debug_version_for_testing=01.00.00-gversion-test" activate_osd $dir 2 + ceph_debug_version_for_testing=01.00.00-gversion-test activate_osd $dir 2 kill_daemons $dir KILL osd.0 - EXTRA_OPTS=" --debug_version_for_testing=02.00.00-gversion-test" activate_osd $dir 0 + ceph_debug_version_for_testing=02.00.00-gversion-test activate_osd $dir 0 wait_for_health_string "HEALTH_ERR .*There are daemons running multiple old versions of ceph" || return 1 @@ -187,7 +187,7 @@ function TEST_check_version_health_3() { ceph health detail | grep DAEMON_OLD_VERSION && return 1 kill_daemons $dir KILL osd.1 - EXTRA_OPTS=" --debug_version_for_testing=01.00.00-gversion-test" activate_osd $dir 1 + ceph_debug_version_for_testing=01.00.00-gversion-test activate_osd $dir 1 # Wait 50% of 20 second delay config sleep 10 @@ -204,9 +204,9 @@ function TEST_check_version_health_3() { ceph health detail | grep -q "osd.1 is running an older version of ceph: 01.00.00-gversion-test" || return 1 kill_daemons $dir KILL osd.2 - EXTRA_OPTS=" --debug_version_for_testing=01.00.00-gversion-test" activate_osd $dir 2 + ceph_debug_version_for_testing=01.00.00-gversion-test activate_osd $dir 2 kill_daemons $dir KILL osd.0 - EXTRA_OPTS=" --debug_version_for_testing=02.00.00-gversion-test" activate_osd $dir 0 + ceph_debug_version_for_testing=02.00.00-gversion-test activate_osd $dir 0 wait_for_health_string "HEALTH_ERR .*There are daemons running multiple old versions of ceph" || return 1 diff --git a/src/common/admin_socket.cc b/src/common/admin_socket.cc index 95a1efc54e66f..01021d94193bf 100644 --- a/src/common/admin_socket.cc +++ b/src/common/admin_socket.cc @@ -631,9 +631,7 @@ public: } else { f->open_object_section("version"); if (command == "version") { -#ifndef WITH_ALIEN - f->dump_string("version", ceph_version_to_str(nullptr)); -#endif + f->dump_string("version", ceph_version_to_str()); f->dump_string("release", ceph_release_to_str()); f->dump_string("release_type", ceph_release_type()); } else if (command == "git_version") { diff --git a/src/common/options.cc b/src/common/options.cc index 367e52ee0dba2..a85d0ffe21083 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -8821,10 +8821,6 @@ std::vector