From: Sage Weil Date: Wed, 12 Jun 2019 16:07:48 +0000 (-0500) Subject: ceph_test_rados_api_tier_pp: fix osd version checks X-Git-Tag: v15.1.0~2308^2~49 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=419251a401f58c78fabe006cd978a968bb6c8087;p=ceph.git ceph_test_rados_api_tier_pp: fix osd version checks These need to exclude old releases but run the test for newer, unnamed releases. Signed-off-by: Sage Weil --- diff --git a/src/test/librados/tier_cxx.cc b/src/test/librados/tier_cxx.cc index a9727c08e0b6..885755279014 100644 --- a/src/test/librados/tier_cxx.cc +++ b/src/test/librados/tier_cxx.cc @@ -63,6 +63,32 @@ void flush_evict_all(librados::Rados& cluster, librados::IoCtx& cache_ioctx) } } +static string _get_required_osd_release(Rados& cluster) +{ + bufferlist inbl; + string cmd = string("{\"prefix\": \"osd dump\",\"format\":\"json\"}"); + bufferlist outbl; + int r = cluster.mon_command(cmd, inbl, &outbl, NULL); + ceph_assert(r >= 0); + string outstr(outbl.c_str(), outbl.length()); + json_spirit::Value v; + if (!json_spirit::read(outstr, v)) { + cerr <<" unable to parse json " << outstr << std::endl; + return ""; + } + + json_spirit::Object& o = v.get_obj(); + for (json_spirit::Object::size_type i=0; i 0); @@ -2954,16 +2979,9 @@ TEST_F(LibRadosTwoPoolsPP, SetRedirectRead) { TEST_F(LibRadosTwoPoolsPP, SetChunkRead) { // skip test if not yet mimic - { - bufferlist inbl, outbl; - ASSERT_EQ(0, cluster.mon_command( - "{\"prefix\": \"osd dump\"}", - inbl, &outbl, NULL)); - string s(outbl.c_str(), outbl.length()); - if (s.find("mimic") == std::string::npos) { - cout << "cluster is not yet mimic, skipping test" << std::endl; - return; - } + if (_get_required_osd_release(cluster) < "mimic") { + cout << "cluster is not yet mimic, skipping test" << std::endl; + return; } // create object @@ -3032,16 +3050,9 @@ TEST_F(LibRadosTwoPoolsPP, SetChunkRead) { TEST_F(LibRadosTwoPoolsPP, ManifestPromoteRead) { // skip test if not yet mimic - { - bufferlist inbl, outbl; - ASSERT_EQ(0, cluster.mon_command( - "{\"prefix\": \"osd dump\"}", - inbl, &outbl, NULL)); - string s(outbl.c_str(), outbl.length()); - if (s.find("mimic") == std::string::npos) { - cout << "cluster is not yet mimic, skipping test" << std::endl; - return; - } + if (_get_required_osd_release(cluster) < "mimic") { + cout << "cluster is not yet mimic, skipping test" << std::endl; + return; } // create object @@ -3236,16 +3247,9 @@ TEST_F(LibRadosTwoPoolsPP, ManifestRefRead) { TEST_F(LibRadosTwoPoolsPP, ManifestUnset) { // skip test if not yet nautilus - { - bufferlist inbl, outbl; - ASSERT_EQ(0, cluster.mon_command( - "{\"prefix\": \"osd dump\"}", - inbl, &outbl, NULL)); - string s(outbl.c_str(), outbl.length()); - if (s.find("nautilus") == std::string::npos) { - cout << "cluster is not yet nautilus, skipping test" << std::endl; - return; - } + if (_get_required_osd_release(cluster) < "nautilus") { + cout << "cluster is not yet nautilus, skipping test" << std::endl; + return; } // create object @@ -3387,17 +3391,11 @@ using ceph::crypto::SHA1; #include "rgw/rgw_common.h" TEST_F(LibRadosTwoPoolsPP, ManifestDedupRefRead) { // skip test if not yet nautilus - { - bufferlist inbl, outbl; - ASSERT_EQ(0, cluster.mon_command( - "{\"prefix\": \"osd dump\"}", - inbl, &outbl, NULL)); - string s(outbl.c_str(), outbl.length()); - if (s.find("nautilus") == std::string::npos) { - cout << "cluster is not yet nautilus, skipping test" << std::endl; - return; - } + if (_get_required_osd_release(cluster) < "nautilus") { + cout << "cluster is not yet nautilus, skipping test" << std::endl; + return; } + bufferlist inbl; ASSERT_EQ(0, cluster.mon_command( set_pool_str(pool_name, "fingerprint_algorithm", "sha1"),