@@ -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 ),
@@ -844,18 +846,32 @@ const std::string ceph::io_sequence::tester::SelectErasurePool::select() {
844846 ceph::messaging::osd::OSDPoolGetReply pool_get_reply;
845847 pool_get_reply.decode_json (&p);
846848
847- 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+ }
848860 } else {
861+ pool_type = pg_pool_t ::TYPE_ERASURE;
849862 created_pool_name = create ();
850863 }
851864
852865 if (!dry_run) {
853- configureServices (force_value.value_or (created_pool_name),
866+ configureServices (force_value.value_or (created_pool_name), pool_type,
854867 allow_pool_autoscaling, allow_pool_balancer,
855868 allow_pool_deep_scrubbing, allow_pool_scrubbing,
856869 allow_pool_ec_optimizations, true , test_recovery);
857870
858- setApplication (created_pool_name);
871+ if (!force_value)
872+ {
873+ setApplication (created_pool_name);
874+ }
859875 }
860876 }
861877
@@ -898,6 +914,7 @@ void ceph::io_sequence::tester::SelectErasurePool::setApplication(
898914
899915void ceph::io_sequence::tester::SelectErasurePool::configureServices (
900916 const std::string& pool_name,
917+ PoolType pool_type,
901918 bool allow_pool_autoscaling,
902919 bool allow_pool_balancer,
903920 bool allow_pool_deep_scrubbing,
@@ -953,26 +970,29 @@ void ceph::io_sequence::tester::SelectErasurePool::configureServices(
953970 ceph_assert (rc == 0 );
954971 }
955972
956- if (allow_pool_ec_optimizations) {
957- ceph::messaging::osd::OSDPoolSetRequest
958- allow_ec_optimisations_request{pool_name,
959- " allow_ec_optimizations" ,
960- " true" ,
961- std::nullopt };
962- rc = send_mon_command (allow_ec_optimisations_request, rados,
963- " OSDPoolSetRequest" , inbl, &outbl, formatter.get ());
964- ceph_assert (rc == 0 );
965- }
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+ }
966985
967- if (allow_pool_ec_overwrites) {
968- ceph::messaging::osd::OSDPoolSetRequest
969- allow_ec_optimisations_request{pool_name,
970- " allow_ec_overwrites" ,
971- " true" ,
972- std::nullopt };
973- rc = send_mon_command (allow_ec_optimisations_request, rados,
974- " OSDPoolSetRequest" , inbl, &outbl, formatter.get ());
975- 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+ }
976996 }
977997
978998 if (test_recovery) {
@@ -1005,11 +1025,13 @@ ceph::io_sequence::tester::TestObject::TestObject(
10051025 } else {
10061026 const std::string pool = spo.select ();
10071027 if (!dryrun) {
1008- ceph_assert (spo.getProfile ());
1009- pool_km = spo.getProfile ()->km ;
1010- if (spo.getProfile ()->mapping && spo.getProfile ()->layers ) {
1011- pool_mappinglayers = {*spo.getProfile ()->mapping ,
1012- *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+ }
10131035 }
10141036 }
10151037
@@ -1039,7 +1061,8 @@ ceph::io_sequence::tester::TestObject::TestObject(
10391061
10401062 exerciser_model = std::make_unique<ceph::io_exerciser::RadosIo>(
10411063 rados, asio, pool, oid, cached_shard_order, sbs.select (), rng (),
1042- threads, lock, cond, spo.get_allow_pool_ec_optimizations ());
1064+ threads, lock, cond, spo.is_replicated_pool (),
1065+ spo.get_allow_pool_ec_optimizations ());
10431066 dout (0 ) << " = " << oid << " pool=" << pool << " threads=" << threads
10441067 << " blocksize=" << exerciser_model->get_block_size () << " ="
10451068 << dendl;
@@ -1131,6 +1154,7 @@ ceph::io_sequence::tester::TestRunner::TestRunner(
11311154 vm.contains (" allow_pool_balancer" ),
11321155 vm.contains (" allow_pool_deep_scrubbing" ),
11331156 vm.contains (" allow_pool_scrubbing" ),
1157+ vm.contains (" checkconsistency" ),
11341158 vm.contains (" testrecovery" ),
11351159 !vm.contains (" disable_pool_ec_optimizations" )},
11361160 snt{rng, vm, " threads" , true },
@@ -1318,7 +1342,7 @@ bool ceph::io_sequence::tester::TestRunner::run_interactive_test() {
13181342 model = std::make_unique<ceph::io_exerciser::RadosIo>(
13191343 rados, asio, pool, object_name, osd_map_reply.acting , sbs.select (), rng (),
13201344 1 , // 1 thread
1321- lock, cond,
1345+ lock, cond, spo. is_replicated_pool (),
13221346 spo.get_allow_pool_ec_optimizations ());
13231347 }
13241348
@@ -1474,6 +1498,10 @@ bool ceph::io_sequence::tester::TestRunner::run_automated_test() {
14741498 std::cerr << " Error: " << e.what () << std::endl;
14751499 return false ;
14761500 }
1501+ catch (const std::invalid_argument &e) {
1502+ std::cerr << " Error: " << e.what () << std::endl;
1503+ return false ;
1504+ }
14771505 }
14781506 if (!dryrun) {
14791507 rados.wait_for_latest_osdmap ();
0 commit comments