@@ -134,7 +134,7 @@ constexpr std::string_view usage[] = {
134134 " ceph_test_rados_io_sequence --blocksize <b> --pool <p> --object <oid>" ,
135135 " --objectsize <min,max> --threads <t>" ,
136136 " \t Customize the test, if a pool is specified then it defines the" ,
137- " \t Replica /EC configuration" ,
137+ " \t Replicated /EC configuration" ,
138138 " " ,
139139 " ceph_test_rados_io_sequence --listsequence" ,
140140 " \t Display list of supported I/O sequences" ,
@@ -793,6 +793,7 @@ ceph::io_sequence::tester::SelectErasurePool::SelectErasurePool(
793793 bool allow_pool_balancer,
794794 bool allow_pool_deep_scrubbing,
795795 bool allow_pool_scrubbing,
796+ bool check_consistency,
796797 bool test_recovery,
797798 bool allow_pool_ec_optimizations)
798799 : ProgramOptionReader<std::string>(vm, " pool" ),
@@ -802,6 +803,7 @@ ceph::io_sequence::tester::SelectErasurePool::SelectErasurePool(
802803 allow_pool_balancer(allow_pool_balancer),
803804 allow_pool_deep_scrubbing(allow_pool_deep_scrubbing),
804805 allow_pool_scrubbing(allow_pool_scrubbing),
806+ check_consistency(check_consistency),
805807 test_recovery(test_recovery),
806808 allow_pool_ec_optimizations(allow_pool_ec_optimizations),
807809 first_use(true ),
@@ -831,7 +833,8 @@ const std::string ceph::io_sequence::tester::SelectErasurePool::select() {
831833 bufferlist inbl, outbl;
832834 auto formatter = std::make_shared<JSONFormatter>(false );
833835
834- ceph::messaging::osd::OSDPoolGetRequest osdPoolGetRequest{*force_value};
836+ ceph::messaging::osd::OSDPoolGetRequest osdPoolGetRequest{*force_value,
837+ " all" };
835838 rc = send_mon_command (osdPoolGetRequest, rados, " OSDPoolGetRequest" , inbl,
836839 &outbl, formatter.get ());
837840 ceph_assert (rc == 0 );
@@ -843,18 +846,32 @@ const std::string ceph::io_sequence::tester::SelectErasurePool::select() {
843846 ceph::messaging::osd::OSDPoolGetReply pool_get_reply;
844847 pool_get_reply.decode_json (&p);
845848
846- profile = sep.selectExistingProfile (pool_get_reply.erasure_code_profile );
849+ if (pool_get_reply.erasure_code_profile .has_value ()) {
850+ pool_type = pg_pool_t ::TYPE_ERASURE;
851+ profile = sep.selectExistingProfile (*pool_get_reply.erasure_code_profile );
852+ } else {
853+ pool_type = pg_pool_t ::TYPE_REPLICATED;
854+ if (check_consistency) {
855+ throw std::invalid_argument (fmt::format (" checkconsistency option not "
856+ " allowed if using a {} pool" ,
857+ pg_pool_t::get_type_name (pool_type)));
858+ }
859+ }
847860 } else {
861+ pool_type = pg_pool_t ::TYPE_ERASURE;
848862 created_pool_name = create ();
849863 }
850864
851865 if (!dry_run) {
852- configureServices (force_value.value_or (created_pool_name),
866+ configureServices (force_value.value_or (created_pool_name), pool_type,
853867 allow_pool_autoscaling, allow_pool_balancer,
854868 allow_pool_deep_scrubbing, allow_pool_scrubbing,
855869 allow_pool_ec_optimizations, true , test_recovery);
856870
857- setApplication (created_pool_name);
871+ if (!force_value)
872+ {
873+ setApplication (created_pool_name);
874+ }
858875 }
859876 }
860877
@@ -897,6 +914,7 @@ void ceph::io_sequence::tester::SelectErasurePool::setApplication(
897914
898915void ceph::io_sequence::tester::SelectErasurePool::configureServices (
899916 const std::string& pool_name,
917+ PoolType pool_type,
900918 bool allow_pool_autoscaling,
901919 bool allow_pool_balancer,
902920 bool allow_pool_deep_scrubbing,
@@ -952,26 +970,29 @@ void ceph::io_sequence::tester::SelectErasurePool::configureServices(
952970 ceph_assert (rc == 0 );
953971 }
954972
955- if (allow_pool_ec_optimizations) {
956- ceph::messaging::osd::OSDPoolSetRequest
957- allow_ec_optimisations_request{pool_name,
958- " allow_ec_optimizations" ,
959- " true" ,
960- std::nullopt };
961- rc = send_mon_command (allow_ec_optimisations_request, rados,
962- " OSDPoolSetRequest" , inbl, &outbl, formatter.get ());
963- ceph_assert (rc == 0 );
964- }
973+ if (pool_type == pg_pool_t ::TYPE_ERASURE)
974+ {
975+ if (allow_pool_ec_optimizations) {
976+ ceph::messaging::osd::OSDPoolSetRequest
977+ allow_ec_optimisations_request{pool_name,
978+ " allow_ec_optimizations" ,
979+ " true" ,
980+ std::nullopt };
981+ rc = send_mon_command (allow_ec_optimisations_request, rados,
982+ " OSDPoolSetRequest" , inbl, &outbl, formatter.get ());
983+ ceph_assert (rc == 0 );
984+ }
965985
966- if (allow_pool_ec_overwrites) {
967- ceph::messaging::osd::OSDPoolSetRequest
968- allow_ec_optimisations_request{pool_name,
969- " allow_ec_overwrites" ,
970- " true" ,
971- std::nullopt };
972- rc = send_mon_command (allow_ec_optimisations_request, rados,
973- " OSDPoolSetRequest" , inbl, &outbl, formatter.get ());
974- ceph_assert (rc == 0 );
986+ if (allow_pool_ec_overwrites) {
987+ ceph::messaging::osd::OSDPoolSetRequest
988+ allow_ec_optimisations_request{pool_name,
989+ " allow_ec_overwrites" ,
990+ " true" ,
991+ std::nullopt };
992+ rc = send_mon_command (allow_ec_optimisations_request, rados,
993+ " OSDPoolSetRequest" , inbl, &outbl, formatter.get ());
994+ ceph_assert (rc == 0 );
995+ }
975996 }
976997
977998 if (test_recovery) {
@@ -1004,11 +1025,13 @@ ceph::io_sequence::tester::TestObject::TestObject(
10041025 } else {
10051026 const std::string pool = spo.select ();
10061027 if (!dryrun) {
1007- ceph_assert (spo.getProfile ());
1008- pool_km = spo.getProfile ()->km ;
1009- if (spo.getProfile ()->mapping && spo.getProfile ()->layers ) {
1010- pool_mappinglayers = {*spo.getProfile ()->mapping ,
1011- *spo.getProfile ()->layers };
1028+ if (!spo.is_replicated_pool ()) {
1029+ ceph_assert (spo.getProfile ());
1030+ pool_km = spo.getProfile ()->km ;
1031+ if (spo.getProfile ()->mapping && spo.getProfile ()->layers ) {
1032+ pool_mappinglayers = {*spo.getProfile ()->mapping ,
1033+ *spo.getProfile ()->layers };
1034+ }
10121035 }
10131036 }
10141037
@@ -1038,7 +1061,8 @@ ceph::io_sequence::tester::TestObject::TestObject(
10381061
10391062 exerciser_model = std::make_unique<ceph::io_exerciser::RadosIo>(
10401063 rados, asio, pool, oid, cached_shard_order, sbs.select (), rng (),
1041- threads, lock, cond, spo.get_allow_pool_ec_optimizations ());
1064+ threads, lock, cond, spo.is_replicated_pool (),
1065+ spo.get_allow_pool_ec_optimizations ());
10421066 dout (0 ) << " = " << oid << " pool=" << pool << " threads=" << threads
10431067 << " blocksize=" << exerciser_model->get_block_size () << " ="
10441068 << dendl;
@@ -1130,6 +1154,7 @@ ceph::io_sequence::tester::TestRunner::TestRunner(
11301154 vm.contains (" allow_pool_balancer" ),
11311155 vm.contains (" allow_pool_deep_scrubbing" ),
11321156 vm.contains (" allow_pool_scrubbing" ),
1157+ vm.contains (" checkconsistency" ),
11331158 vm.contains (" testrecovery" ),
11341159 !vm.contains (" disable_pool_ec_optimizations" )},
11351160 snt{rng, vm, " threads" , true },
@@ -1317,7 +1342,7 @@ bool ceph::io_sequence::tester::TestRunner::run_interactive_test() {
13171342 model = std::make_unique<ceph::io_exerciser::RadosIo>(
13181343 rados, asio, pool, object_name, osd_map_reply.acting , sbs.select (), rng (),
13191344 1 , // 1 thread
1320- lock, cond,
1345+ lock, cond, spo. is_replicated_pool (),
13211346 spo.get_allow_pool_ec_optimizations ());
13221347 }
13231348
@@ -1473,6 +1498,10 @@ bool ceph::io_sequence::tester::TestRunner::run_automated_test() {
14731498 std::cerr << " Error: " << e.what () << std::endl;
14741499 return false ;
14751500 }
1501+ catch (const std::invalid_argument &e) {
1502+ std::cerr << " Error: " << e.what () << std::endl;
1503+ return false ;
1504+ }
14761505 }
14771506 if (!dryrun) {
14781507 rados.wait_for_latest_osdmap ();
0 commit comments