Skip to content

Commit 9d81862

Browse files
Merge pull request ceph#64136 from JonBailey1993/ceph_test_rados_io_sequence_10_bug_fix
test/osd: Fix pack for minor issues in ceph_test_rados_io_sequence Reviewed-by: Ronen Friedman <[email protected]>
2 parents 48a0613 + 2740007 commit 9d81862

File tree

4 files changed

+64
-8
lines changed

4 files changed

+64
-8
lines changed

src/common/json/OSDStructures.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,21 @@ void InjectECClearParityRead::dump(Formatter* f) const {
183183
void InjectECClearParityRead::decode_json(JSONObj* obj) {
184184
JSONDecoder::decode_json("pool", pool, obj);
185185
JSONDecoder::decode_json("objname", objname, obj);
186+
}
187+
188+
void OSDEnableApplicationRequest::dump(Formatter* f) const {
189+
encode_json("prefix", "osd pool application enable", f);
190+
encode_json("pool", pool, f);
191+
encode_json("app", app, f);
192+
encode_json("yes_i_really_mean_it", yes_i_really_mean_it, f);
193+
encode_json("key", key, f);
194+
encode_json("value", value, f);
195+
}
196+
197+
void OSDEnableApplicationRequest::decode_json(JSONObj* obj) {
198+
JSONDecoder::decode_json("pool", pool, obj);
199+
JSONDecoder::decode_json("app", app, obj);
200+
JSONDecoder::decode_json("yes_i_really_mean_it", yes_i_really_mean_it, obj);
201+
JSONDecoder::decode_json("key", key, obj);
202+
JSONDecoder::decode_json("value", value, obj);
186203
}

src/common/json/OSDStructures.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ struct OSDSetRequest {
113113
void decode_json(JSONObj* obj);
114114
};
115115

116+
struct OSDEnableApplicationRequest {
117+
std::string pool;
118+
std::string app;
119+
std::optional<bool> yes_i_really_mean_it;
120+
std::optional<std::string> key;
121+
std::optional<std::string> value;
122+
123+
void dump(Formatter* f) const;
124+
void decode_json(JSONObj* obj);
125+
};
126+
116127
// These structures are sent directly to the relevant OSD
117128
// rather than the monitor
118129
template <io_exerciser::InjectOpType op_type>

src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.cc

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,11 @@ constexpr std::string_view usage[] = {
161161
"\t\t read|write|failedwrite <off> <len>",
162162
"\t\t read2|write2|failedwrite2 <off> <len> <off> <len>",
163163
"\t\t read3|write3|failedwrite3 <off> <len> <off> <len> <off> <len>",
164-
"\t\t injecterror <type> <shard> <good_count> <fail_count>",
165-
"\t\t clearinject <type> <shard>",
164+
"\t\t append",
165+
"\t\t truncate",
166+
"\t\t injecterror <io_type> <shard> <type> <good_count> <fail_count>",
167+
"\t\t clearinject <io_type> <shard> <type>",
168+
"\t\t sleep",
166169
"\t\t done"};
167170

168171
po::options_description get_options_description() {
@@ -849,6 +852,8 @@ const std::string ceph::io_sequence::tester::SelectErasurePool::select() {
849852
configureServices(allow_pool_autoscaling, allow_pool_balancer,
850853
allow_pool_deep_scrubbing, allow_pool_scrubbing,
851854
test_recovery);
855+
856+
setApplication(created_pool_name);
852857
}
853858
}
854859

@@ -874,6 +879,21 @@ std::string ceph::io_sequence::tester::SelectErasurePool::create() {
874879
return pool_name;
875880
}
876881

882+
void ceph::io_sequence::tester::SelectErasurePool::setApplication(
883+
const std::string& pool_name) {
884+
bufferlist inbl, outbl;
885+
auto formatter = std::make_shared<JSONFormatter>(false);
886+
887+
ceph::messaging::osd::OSDEnableApplicationRequest
888+
enableApplicationRequest{pool_name, "rados"};
889+
890+
int rc = send_mon_command(enableApplicationRequest, rados,
891+
"OSDEnableApplicationRequest", inbl, &outbl,
892+
formatter.get());
893+
894+
ceph_assert(rc == 0);
895+
}
896+
877897
void ceph::io_sequence::tester::SelectErasurePool::configureServices(
878898
bool allow_pool_autoscaling,
879899
bool allow_pool_balancer,
@@ -1084,7 +1104,7 @@ ceph::io_sequence::tester::TestRunner::TestRunner(
10841104
vm.contains("allow_pool_balancer"),
10851105
vm.contains("allow_pool_deep_scrubbing"),
10861106
vm.contains("allow_pool_scrubbing"),
1087-
vm.contains("test_recovery"),
1107+
vm.contains("testrecovery"),
10881108
vm.contains("disable_pool_ec_optimizations")},
10891109
snt{rng, vm, "threads", true},
10901110
ssr{vm} {
@@ -1109,6 +1129,11 @@ ceph::io_sequence::tester::TestRunner::TestRunner(
11091129
allow_pool_scrubbing = vm.contains("allow_pool_scrubbing");
11101130
disable_pool_ec_optimizations = vm.contains("disable_pool_ec_optimizations");
11111131

1132+
if (testrecovery && (num_objects > 1)) {
1133+
throw std::invalid_argument("testrecovery option not allowed if parallel is"
1134+
" specified, except when parallel=1 is used");
1135+
}
1136+
11121137
if (!dryrun) {
11131138
guard.emplace(boost::asio::make_work_guard(asio));
11141139
thread = make_named_thread("io_thread", [&asio = asio] { asio.run(); });

src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,6 @@ class SelectErasurePool : public ProgramOptionReader<std::string> {
392392
bool disable_pool_ec_optimizations);
393393
const std::string select() override;
394394
std::string create();
395-
void configureServices(bool allow_pool_autoscaling,
396-
bool allow_pool_balancer,
397-
bool allow_pool_deep_scrubbing,
398-
bool allow_pool_scrubbing,
399-
bool test_recovery);
400395

401396
inline bool get_allow_pool_autoscaling() { return allow_pool_autoscaling; }
402397
inline bool get_allow_pool_balancer() { return allow_pool_balancer; }
@@ -425,6 +420,14 @@ class SelectErasurePool : public ProgramOptionReader<std::string> {
425420
SelectErasureProfile sep;
426421

427422
std::optional<Profile> profile;
423+
424+
void configureServices(bool allow_pool_autoscaling,
425+
bool allow_pool_balancer,
426+
bool allow_pool_deep_scrubbing,
427+
bool allow_pool_scrubbing,
428+
bool test_recovery);
429+
430+
void setApplication(const std::string& pool_name);
428431
};
429432

430433
class TestObject {

0 commit comments

Comments
 (0)