1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
#pragma once
#include <memory>
#include <string>
#include <vector>
#include "common/ceph_json.h"
#include "common/io_exerciser/OpType.h"
#include "include/types.h"
class JSONObj;
namespace ceph {
namespace messaging {
namespace osd {
struct OSDMapRequest {
std::string pool;
std::string object;
std::string nspace;
std::string format = "json";
void dump(Formatter* f) const;
void decode_json(JSONObj* obj);
};
struct OSDMapReply {
epoch_t epoch;
std::string pool;
uint64_t pool_id;
std::string objname;
std::string raw_pgid;
std::string pgid;
std::vector<int> up;
int up_primary;
std::vector<int> acting;
int acting_primary;
void dump(Formatter* f) const;
void decode_json(JSONObj* obj);
};
struct OSDPoolGetRequest {
std::string pool;
std::string var = "erasure_code_profile";
std::string format = "json";
void dump(Formatter* f) const;
void decode_json(JSONObj* obj);
};
struct OSDPoolGetReply {
std::string erasure_code_profile;
void dump(Formatter* f) const;
void decode_json(JSONObj* obj);
};
struct OSDECProfileGetRequest {
std::string name;
std::string format = "json";
void dump(Formatter* f) const;
void decode_json(JSONObj* obj);
};
struct OSDECProfileGetReply {
std::string crush_device_class;
std::string crush_failure_domain;
int crush_num_failure_domains;
int crush_osds_per_failure_domain;
std::string crush_root;
bool jerasure_per_chunk_alignment;
int k;
int m;
std::string plugin;
std::string technique;
std::string w;
void dump(Formatter* f) const;
void decode_json(JSONObj* obj);
};
struct OSDECProfileSetRequest {
std::string name;
std::vector<std::string> profile;
void dump(Formatter* f) const;
void decode_json(JSONObj* obj);
};
struct OSDECPoolCreateRequest {
std::string pool;
std::string pool_type;
int pg_num;
int pgp_num;
std::string erasure_code_profile;
void dump(Formatter* f) const;
void decode_json(JSONObj* obj);
};
struct OSDSetRequest {
std::string key;
std::optional<bool> yes_i_really_mean_it = std::nullopt;
void dump(Formatter* f) const;
void decode_json(JSONObj* obj);
};
// These structures are sent directly to the relevant OSD
// rather than the monitor
template <io_exerciser::InjectOpType op_type>
struct InjectECErrorRequest {
std::string pool;
std::string objname;
int shardid;
std::optional<uint64_t> type;
std::optional<uint64_t> when;
std::optional<uint64_t> duration;
void dump(Formatter* f) const {
switch (op_type) {
case io_exerciser::InjectOpType::ReadEIO:
[[fallthrough]];
case io_exerciser::InjectOpType::ReadMissingShard:
::encode_json("prefix", "injectecreaderr", f);
break;
case io_exerciser::InjectOpType::WriteFailAndRollback:
[[fallthrough]];
case io_exerciser::InjectOpType::WriteOSDAbort:
::encode_json("prefix", "injectecwriteerr", f);
break;
default:
ceph_abort_msg("Unsupported Inject Type");
}
::encode_json("pool", pool, f);
::encode_json("objname", objname, f);
::encode_json("shardid", shardid, f);
::encode_json("type", type, f);
::encode_json("when", when, f);
::encode_json("duration", duration, f);
}
void decode_json(JSONObj* obj) {
JSONDecoder::decode_json("pool", pool, obj);
JSONDecoder::decode_json("objname", objname, obj);
JSONDecoder::decode_json("shardid", shardid, obj);
JSONDecoder::decode_json("type", type, obj);
JSONDecoder::decode_json("when", when, obj);
JSONDecoder::decode_json("duration", duration, obj);
}
};
template <io_exerciser::InjectOpType op_type>
struct InjectECClearErrorRequest {
std::string pool;
std::string objname;
int shardid;
std::optional<uint64_t> type;
void dump(Formatter* f) const {
switch (op_type) {
case io_exerciser::InjectOpType::ReadEIO:
[[fallthrough]];
case io_exerciser::InjectOpType::ReadMissingShard:
::encode_json("prefix", "injectecclearreaderr", f);
break;
case io_exerciser::InjectOpType::WriteFailAndRollback:
[[fallthrough]];
case io_exerciser::InjectOpType::WriteOSDAbort:
::encode_json("prefix", "injectecclearwriteerr", f);
break;
default:
ceph_abort_msg("Unsupported Inject Type");
}
::encode_json("pool", pool, f);
::encode_json("objname", objname, f);
::encode_json("shardid", shardid, f);
::encode_json("type", type, f);
}
void decode_json(JSONObj* obj) {
JSONDecoder::decode_json("pool", pool, obj);
JSONDecoder::decode_json("objname", objname, obj);
JSONDecoder::decode_json("shardid", shardid, obj);
JSONDecoder::decode_json("type", type, obj);
}
};
} // namespace osd
} // namespace messaging
} // namespace ceph
|