namespace {
template <typename S>
int send_osd_command(int osd, S& s, librados::Rados& rados, const char* name,
- ceph::buffer::list& inbl, ceph::buffer::list* outbl,
+ ceph::buffer::list&& inbl, ceph::buffer::list* outbl,
Formatter* f) {
encode_json(name, s, f);
std::ostringstream oss;
f->flush(oss);
- int rc = rados.osd_command(osd, oss.str(), inbl, outbl, nullptr);
+ int rc = rados.osd_command(osd, oss.str(), std::move(inbl), outbl, nullptr);
return rc;
}
template <typename S>
int send_mon_command(S& s, librados::Rados& rados, const char* name,
- ceph::buffer::list& inbl, ceph::buffer::list* outbl,
+ ceph::buffer::list&& inbl, ceph::buffer::list* outbl,
Formatter* f) {
encode_json(name, s, f);
std::ostringstream oss;
f->flush(oss);
- int rc = rados.mon_command(oss.str(), inbl, outbl, nullptr);
+ int rc = rados.mon_command(oss.str(), std::move(inbl), outbl, nullptr);
return rc;
}
} // namespace
}
void RadosIo::applyInjectOp(IoOp& op) {
- bufferlist osdmap_inbl, inject_inbl, osdmap_outbl, inject_outbl;
+ bufferlist osdmap_outbl, inject_outbl;
auto formatter = std::make_unique<JSONFormatter>(false);
int osd = -1;
std::vector<int> shard_order;
ceph::messaging::osd::OSDMapRequest osdMapRequest{pool, get_primary_oid(), ""};
- int rc = send_mon_command(osdMapRequest, rados, "OSDMapRequest", osdmap_inbl,
+ int rc = send_mon_command(osdMapRequest, rados, "OSDMapRequest", {},
&osdmap_outbl, formatter.get());
ceph_assert(rc == 0);
injectErrorRequest{pool, primary_oid, errorOp.shard,
errorOp.type, errorOp.when, errorOp.duration};
int rc = send_osd_command(osd, injectErrorRequest, rados,
- "InjectECErrorRequest", inject_inbl,
+ "InjectECErrorRequest", {},
&inject_outbl, formatter.get());
ceph_assert(rc == 0);
} else if (errorOp.type == 1) {
injectErrorRequest{pool, primary_oid, errorOp.shard,
errorOp.type, errorOp.when, errorOp.duration};
int rc = send_osd_command(osd, injectErrorRequest, rados,
- "InjectECErrorRequest", inject_inbl,
+ "InjectECErrorRequest", {},
&inject_outbl, formatter.get());
ceph_assert(rc == 0);
} else {
injectErrorRequest{pool, primary_oid, errorOp.shard,
errorOp.type, errorOp.when, errorOp.duration};
int rc = send_osd_command(osd, injectErrorRequest, rados,
- "InjectECErrorRequest", inject_inbl,
+ "InjectECErrorRequest", {},
&inject_outbl, formatter.get());
ceph_assert(rc == 0);
} else if (errorOp.type == 3) {
injectErrorRequest{pool, primary_oid, errorOp.shard,
errorOp.type, errorOp.when, errorOp.duration};
int rc = send_osd_command(osd, injectErrorRequest, rados,
- "InjectECErrorRequest", inject_inbl,
+ "InjectECErrorRequest", {},
&inject_outbl, formatter.get());
ceph_assert(rc == 0);
ceph::messaging::osd::InjectECClearErrorRequest<InjectOpType::ReadEIO>
clearErrorInject{pool, primary_oid, errorOp.shard, errorOp.type};
int rc = send_osd_command(osd, clearErrorInject, rados,
- "InjectECClearErrorRequest", inject_inbl,
+ "InjectECClearErrorRequest", {},
&inject_outbl, formatter.get());
ceph_assert(rc == 0);
} else if (errorOp.type == 1) {
InjectOpType::ReadMissingShard>
clearErrorInject{pool, primary_oid, errorOp.shard, errorOp.type};
int rc = send_osd_command(osd, clearErrorInject, rados,
- "InjectECClearErrorRequest", inject_inbl,
+ "InjectECClearErrorRequest", {},
&inject_outbl, formatter.get());
ceph_assert(rc == 0);
} else {
InjectOpType::WriteFailAndRollback>
clearErrorInject{pool, primary_oid, errorOp.shard, errorOp.type};
int rc = send_osd_command(osd, clearErrorInject, rados,
- "InjectECClearErrorRequest", inject_inbl,
+ "InjectECClearErrorRequest", {},
&inject_outbl, formatter.get());
ceph_assert(rc == 0);
} else if (errorOp.type == 3) {
InjectOpType::WriteOSDAbort>
clearErrorInject{pool, primary_oid, errorOp.shard, errorOp.type};
int rc = send_osd_command(osd, clearErrorInject, rados,
- "InjectECClearErrorRequest", inject_inbl,
+ "InjectECClearErrorRequest", {},
&inject_outbl, formatter.get());
ceph_assert(rc == 0);
} else {
std::ostringstream oss;
formatter.get()->flush(oss);
- ceph::bufferlist inbl, outbl;
- int rc = rados.mon_command(oss.str(), inbl, &outbl, nullptr);
+ ceph::bufferlist outbl;
+ int rc = rados.mon_command(oss.str(), {}, &outbl, nullptr);
ceph_assert(rc == 0);
JSONParser p;
std::ostringstream oss;
formatter.get()->flush(oss);
- ceph::bufferlist inbl, outbl;
- int rc = rados.mon_command(oss.str(), inbl, &outbl, nullptr);
+ ceph::bufferlist outbl;
+ int rc = rados.mon_command(oss.str(), {}, &outbl, nullptr);
ceph_assert(rc == 0);
JSONParser p;
std::ostringstream oss;
formatter.get()->flush(oss);
- ceph::bufferlist inbl, outbl;
- int rc = rados.mon_command(oss.str(), inbl, &outbl, nullptr);
+ ceph::bufferlist outbl;
+ int rc = rados.mon_command(oss.str(), {}, &outbl, nullptr);
ceph_assert(rc == 0);
JSONParser p;
std::ostringstream oss;
formatter.get()->flush(oss);
- ceph::bufferlist inbl, outbl;
- int rc = rados.mon_command(oss.str(), inbl, &outbl, nullptr);
+ ceph::bufferlist outbl;
+ int rc = rados.mon_command(oss.str(), {}, &outbl, nullptr);
ceph_assert(rc == 0);
// Parse the string output into an ErasureCodeProfile
std::ostringstream oss;
formatter.get()->flush(oss);
- ceph::bufferlist inbl, outbl;
- int rc = rados.osd_command(primary_osd, oss.str(), inbl, &outbl, nullptr);
+ ceph::bufferlist outbl;
+ int rc = rados.osd_command(primary_osd, oss.str(), {}, &outbl, nullptr);
ceph_assert(rc == 0);
}
std::ostringstream oss;
formatter.get()->flush(oss);
- ceph::bufferlist inbl, outbl;
- int rc = rados.osd_command(primary_osd, oss.str(), inbl, &outbl, nullptr);
+ ceph::bufferlist outbl;
+ int rc = rados.osd_command(primary_osd, oss.str(), {}, &outbl, nullptr);
ceph_assert(rc == 0);
-}
\ No newline at end of file
+}
std::string, ceph::buffer::list);
using CommandComp = boost::asio::any_completion_handler<CommandSig>;
template<boost::asio::completion_token_for<CommandSig> CompletionToken>
- auto osd_command(int osd, std::vector<std::string> cmd,
- ceph::buffer::list in, CompletionToken&& token) {
+ auto osd_command(int osd, std::vector<std::string>&& cmd,
+ ceph::buffer::list&& in, CompletionToken&& token) {
auto consigned = consign(std::forward<CompletionToken>(token));
return boost::asio::async_initiate<decltype(consigned), CommandSig>(
[osd, this](auto&& handler, std::vector<std::string> cmd,
}, consigned, std::move(cmd), std::move(in));
}
template<boost::asio::completion_token_for<CommandSig> CompletionToken>
- auto pg_command(PG pg, std::vector<std::string> cmd,
- ceph::buffer::list in, CompletionToken&& token) {
+ auto pg_command(PG pg, std::vector<std::string>&& cmd,
+ ceph::buffer::list&& in, CompletionToken&& token) {
auto consigned = consign(std::forward<CompletionToken>(token));
return boost::asio::async_initiate<decltype(consigned), CommandSig>(
[this](auto&& handler, PG pg, std::vector<std::string> cmd,
}
template<boost::asio::completion_token_for<SimpleOpSig> CompletionToken>
- auto mon_command(std::vector<std::string> command,
- ceph::buffer::list bl,
+ auto mon_command(std::vector<std::string>&& command,
+ ceph::buffer::list&& bl,
std::string* outs, ceph::buffer::list* outbl,
CompletionToken&& token) {
auto consigned = consign(std::forward<CompletionToken>(token));
Cursor end, std::uint32_t max,
ceph::buffer::list filter,
EnumerateComp c);
- void osd_command_(int osd, std::vector<std::string> cmd,
- ceph::buffer::list in, CommandComp c);
- void pg_command_(PG pg, std::vector<std::string> cmd,
- ceph::buffer::list in, CommandComp c);
+ void osd_command_(int osd, std::vector<std::string>&& cmd,
+ ceph::buffer::list&& in, CommandComp c);
+ void pg_command_(PG pg, std::vector<std::string>&& cmd,
+ ceph::buffer::list&& in, CommandComp c);
- void mon_command_(std::vector<std::string> command,
- ceph::buffer::list bl,
+ void mon_command_(std::vector<std::string>&& command,
+ ceph::buffer::list&& bl,
std::string* outs, ceph::buffer::list* outbl,
SimpleOpComp c);
int get_min_compatible_client(int8_t* min_compat_client,
int8_t* require_min_compat_client);
- int mon_command(std::string cmd, const bufferlist& inbl,
+ int mon_command(std::string&& cmd, bufferlist&& inbl,
bufferlist *outbl, std::string *outs);
- int mgr_command(std::string cmd, const bufferlist& inbl,
+ int mgr_command(std::string&& cmd, bufferlist&& inbl,
bufferlist *outbl, std::string *outs);
- int osd_command(int osdid, std::string cmd, const bufferlist& inbl,
+ int osd_command(int osdid, std::string&& cmd, bufferlist&& inbl,
bufferlist *outbl, std::string *outs);
- int pg_command(const char *pgstr, std::string cmd, const bufferlist& inbl,
+ int pg_command(const char *pgstr, std::string&& cmd, bufferlist&& inbl,
bufferlist *outbl, std::string *outs);
int ioctx_create(const char *name, IoCtx &pioctx);
}
cmd << "}";
- std::vector<std::string> cmds;
- cmds.push_back(cmd.str());
- bufferlist inbl;
- client->mon_command_async(cmds, inbl, nullptr, nullptr,
+ client->mon_command_async({cmd.str()}, {}, nullptr, nullptr,
make_lambda_context(CB_PoolAsync_Safe(c)));
}
<< "\"value\":\"" << value << "\""
<< "}";
- std::vector<std::string> cmds;
- cmds.push_back(cmd.str());
- bufferlist inbl;
- int r = client->mon_command(cmds, inbl, nullptr, nullptr);
+ int r = client->mon_command({cmd.str()}, {}, nullptr, nullptr);
if (r < 0) {
return r;
}
<< "\"key\":\"" << key << "\""
<< "}";
- std::vector<std::string> cmds;
- cmds.push_back(cmd.str());
- bufferlist inbl;
- int r = client->mon_command(cmds, inbl, nullptr, nullptr);
+ int r = client->mon_command({cmd.str()}, {}, nullptr, nullptr);
if (r < 0) {
return r;
}
std::vector<std::string> cmds;
cmds.push_back(cmd.str());
- bufferlist inbl;
- int r = mon_command(cmds, inbl, NULL, NULL);
+ int r = mon_command(std::move(cmds), {}, NULL, NULL);
if (r == -EINVAL) {
// try legacy blacklist command
std::stringstream cmd;
cmd << "}";
cmds.clear();
cmds.push_back(cmd.str());
- r = mon_command(cmds, inbl, NULL, NULL);
+ r = mon_command(std::move(cmds), {}, NULL, NULL);
}
if (r < 0) {
return r;
return r;
}
-int librados::RadosClient::mon_command(const vector<string>& cmd,
- const bufferlist &inbl,
+int librados::RadosClient::mon_command(vector<string>&& cmd,
+ bufferlist &&inbl,
bufferlist *outbl, string *outs)
{
C_SaferCond ctx;
- mon_command_async(cmd, inbl, outbl, outs, &ctx);
+ mon_command_async(std::move(cmd), std::move(inbl), outbl, outs, &ctx);
return ctx.wait();
}
-void librados::RadosClient::mon_command_async(const vector<string>& cmd,
- const bufferlist &inbl,
+void librados::RadosClient::mon_command_async(vector<string>&& cmd,
+ bufferlist &&inbl,
bufferlist *outbl, string *outs,
Context *on_finish)
{
std::lock_guard l{lock};
- monclient.start_mon_command(cmd, inbl,
+ monclient.start_mon_command(std::move(cmd), std::move(inbl),
[outs, outbl,
on_finish = std::unique_ptr<Context>(on_finish)]
(bs::error_code e,
});
}
-int librados::RadosClient::mgr_command(const vector<string>& cmd,
- const bufferlist &inbl,
+int librados::RadosClient::mgr_command(vector<string>&& cmd,
+ bufferlist &&inbl,
bufferlist *outbl, string *outs)
{
std::lock_guard l(lock);
C_SaferCond cond;
- int r = mgrclient.start_command(cmd, inbl, outbl, outs, &cond);
+ int r = mgrclient.start_command(std::move(cmd), std::move(inbl), outbl, outs, &cond);
if (r < 0)
return r;
}
int librados::RadosClient::mgr_command(
- const string& name,
- const vector<string>& cmd,
- const bufferlist &inbl,
+ string&& name,
+ vector<string>&& cmd,
+ bufferlist &&inbl,
bufferlist *outbl, string *outs)
{
std::lock_guard l(lock);
C_SaferCond cond;
- int r = mgrclient.start_tell_command(name, cmd, inbl, outbl, outs, &cond);
+ int r = mgrclient.start_tell_command(std::move(name), std::move(cmd), std::move(inbl), outbl, outs, &cond);
if (r < 0)
return r;
}
-int librados::RadosClient::mon_command(int rank, const vector<string>& cmd,
- const bufferlist &inbl,
+int librados::RadosClient::mon_command(int rank, vector<string>&& cmd,
+ bufferlist &&inbl,
bufferlist *outbl, string *outs)
{
bs::error_code ec;
- auto&& [s, bl] = monclient.start_mon_command(rank, cmd, inbl,
+ auto&& [s, bl] = monclient.start_mon_command(rank, std::move(cmd), std::move(inbl),
ca::use_blocked[ec]);
if (outs)
*outs = std::move(s);
return ceph::from_error_code(ec);
}
-int librados::RadosClient::mon_command(string name, const vector<string>& cmd,
- const bufferlist &inbl,
+int librados::RadosClient::mon_command(std::string&& name, vector<string>&& cmd,
+ bufferlist &&inbl,
bufferlist *outbl, string *outs)
{
bs::error_code ec;
- auto&& [s, bl] = monclient.start_mon_command(name, cmd, inbl,
+ auto&& [s, bl] = monclient.start_mon_command(std::move(name), std::move(cmd), std::move(inbl),
ca::use_blocked[ec]);
if (outs)
*outs = std::move(s);
return ceph::from_error_code(ec);
}
-int librados::RadosClient::osd_command(int osd, vector<string>& cmd,
- const bufferlist& inbl,
+int librados::RadosClient::osd_command(int osd, vector<string>&& cmd,
+ bufferlist&& inbl,
bufferlist *poutbl, string *prs)
{
ceph_tid_t tid;
return ceph::from_error_code(ec);
}
-int librados::RadosClient::pg_command(pg_t pgid, vector<string>& cmd,
- const bufferlist& inbl,
+int librados::RadosClient::pg_command(pg_t pgid, vector<string>&& cmd,
+ bufferlist&& inbl,
bufferlist *poutbl, string *prs)
{
ceph_tid_t tid;
bs::error_code ec;
- auto [s, bl] = objecter->pg_command(pgid, std::move(cmd), inbl, &tid,
+ auto [s, bl] = objecter->pg_command(pgid, std::move(cmd), std::move(inbl), &tid,
ca::use_blocked[ec]);
if (poutbl)
*poutbl = std::move(bl);
"\"states\": [\"inconsistent\"],"
"\"format\": \"json\"}"
};
- bufferlist inbl, outbl;
+ bufferlist outbl;
string outstring;
- if (auto ret = mgr_command(cmd, inbl, &outbl, &outstring); ret) {
+ if (auto ret = mgr_command(std::move(cmd), {}, &outbl, &outstring); ret) {
return ret;
}
if (!outbl.length()) {
int blocklist_add(const std::string& client_address, uint32_t expire_seconds);
- int mon_command(const std::vector<std::string>& cmd, const bufferlist &inbl,
+ int mon_command(std::vector<std::string> &&cmd, bufferlist &&inbl,
bufferlist *outbl, std::string *outs);
- void mon_command_async(const std::vector<std::string>& cmd, const bufferlist &inbl,
+ void mon_command_async(std::vector<std::string>&& cmd, bufferlist &&inbl,
bufferlist *outbl, std::string *outs, Context *on_finish);
int mon_command(int rank,
- const std::vector<std::string>& cmd, const bufferlist &inbl,
+ std::vector<std::string>&& cmd, bufferlist &&inbl,
bufferlist *outbl, std::string *outs);
- int mon_command(std::string name,
- const std::vector<std::string>& cmd, const bufferlist &inbl,
+ int mon_command(std::string&& name,
+ std::vector<std::string>&& cmd, bufferlist &&inbl,
bufferlist *outbl, std::string *outs);
- int mgr_command(const std::vector<std::string>& cmd, const bufferlist &inbl,
+ int mgr_command(std::vector<std::string>&& cmd, bufferlist &&inbl,
bufferlist *outbl, std::string *outs);
int mgr_command(
- const std::string& name,
- const std::vector<std::string>& cmd, const bufferlist &inbl,
+ std::string&& name,
+ std::vector<std::string>&& cmd, bufferlist &&inbl,
bufferlist *outbl, std::string *outs);
- int osd_command(int osd, std::vector<std::string>& cmd, const bufferlist& inbl,
+ int osd_command(int osd, std::vector<std::string>&& cmd, bufferlist&& inbl,
bufferlist *poutbl, std::string *prs);
- int pg_command(pg_t pgid, std::vector<std::string>& cmd, const bufferlist& inbl,
+ int pg_command(pg_t pgid, std::vector<std::string>&& cmd, bufferlist&& inbl,
bufferlist *poutbl, std::string *prs);
void handle_log(MLog *m);
}
inbl.append(inbuf, inbuflen);
- int ret = client->mon_command(cmdvec, inbl, &outbl, &outstring);
+ int ret = client->mon_command(std::move(cmdvec), std::move(inbl), &outbl, &outstring);
do_out_buffer(outbl, outbuf, outbuflen);
do_out_buffer(outstring, outs, outslen);
inbl.append(inbuf, inbuflen);
int ret;
if (rank >= 0)
- ret = client->mon_command(rank, cmdvec, inbl, &outbl, &outstring);
+ ret = client->mon_command(rank, std::move(cmdvec), std::move(inbl), &outbl, &outstring);
else
- ret = client->mon_command(name, cmdvec, inbl, &outbl, &outstring);
+ ret = client->mon_command(name, std::move(cmdvec), std::move(inbl), &outbl, &outstring);
do_out_buffer(outbl, outbuf, outbuflen);
do_out_buffer(outstring, outs, outslen);
}
inbl.append(inbuf, inbuflen);
- int ret = client->osd_command(osdid, cmdvec, inbl, &outbl, &outstring);
+ int ret = client->osd_command(osdid, std::move(cmdvec), std::move(inbl), &outbl, &outstring);
do_out_buffer(outbl, outbuf, outbuflen);
do_out_buffer(outstring, outs, outslen);
}
inbl.append(inbuf, inbuflen);
- int ret = client->mgr_command(cmdvec, inbl, &outbl, &outstring);
+ int ret = client->mgr_command(std::move(cmdvec), std::move(inbl), &outbl, &outstring);
do_out_buffer(outbl, outbuf, outbuflen);
do_out_buffer(outstring, outs, outslen);
}
inbl.append(inbuf, inbuflen);
- int ret = client->mgr_command(name, cmdvec, inbl, &outbl, &outstring);
+ int ret = client->mgr_command(name, std::move(cmdvec), std::move(inbl), &outbl, &outstring);
do_out_buffer(outbl, outbuf, outbuflen);
do_out_buffer(outstring, outs, outslen);
if (!pgid.parse(pgstr))
return -EINVAL;
- int ret = client->pg_command(pgid, cmdvec, inbl, &outbl, &outstring);
+ int ret = client->pg_command(pgid, std::move(cmdvec), std::move(inbl), &outbl, &outstring);
do_out_buffer(outbl, outbuf, outbuflen);
do_out_buffer(outstring, outs, outslen);
return client->pool_get_name(id, name, true);
}
-int librados::Rados::mon_command(string cmd, const bufferlist& inbl,
+int librados::Rados::mon_command(std::string&& cmd, bufferlist&& inbl,
bufferlist *outbl, string *outs)
{
- vector<string> cmdvec;
- cmdvec.push_back(cmd);
- return client->mon_command(cmdvec, inbl, outbl, outs);
+ return client->mon_command({std::move(cmd)}, std::move(inbl), outbl, outs);
}
-int librados::Rados::osd_command(int osdid, std::string cmd, const bufferlist& inbl,
+int librados::Rados::osd_command(int osdid, std::string&& cmd, bufferlist&& inbl,
bufferlist *outbl, std::string *outs)
{
- vector<string> cmdvec;
- cmdvec.push_back(cmd);
- return client->osd_command(osdid, cmdvec, inbl, outbl, outs);
+ return client->osd_command(osdid, {std::move(cmd)}, std::move(inbl), outbl, outs);
}
-int librados::Rados::mgr_command(std::string cmd, const bufferlist& inbl,
+int librados::Rados::mgr_command(std::string&& cmd, bufferlist&& inbl,
bufferlist *outbl, std::string *outs)
{
- vector<string> cmdvec;
- cmdvec.push_back(cmd);
- return client->mgr_command(cmdvec, inbl, outbl, outs);
+ return client->mgr_command({std::move(cmd)}, std::move(inbl), outbl, outs);
}
-int librados::Rados::pg_command(const char *pgstr, std::string cmd, const bufferlist& inbl,
+int librados::Rados::pg_command(const char *pgstr, std::string&& cmd, bufferlist&& inbl,
bufferlist *outbl, std::string *outs)
{
vector<string> cmdvec;
if (!pgid.parse(pgstr))
return -EINVAL;
- return client->pg_command(pgid, cmdvec, inbl, outbl, outs);
+ return client->pg_command(pgid, std::move(cmdvec), std::move(inbl), outbl, outs);
}
int librados::Rados::ioctx_create(const char *name, IoCtx &io)
bufferlist in_bl;
bufferlist out_bl;
- int r = rados.mon_command(cmd, in_bl, &out_bl, nullptr);
+ int r = rados.mon_command(std::move(cmd), std::move(in_bl), &out_bl, nullptr);
if (r < 0) {
lderr(cct) << "failed to retrieve MON config key " << key << ": "
<< cpp_strerror(r) << dendl;
"\"key\": \"" + key + "\""
"}";
- bufferlist in_bl;
bufferlist out_bl;
- int r = rados.mon_command(cmd, in_bl, &out_bl, nullptr);
+ int r = rados.mon_command(std::move(cmd), {}, &out_bl, nullptr);
if (r == -EINVAL) {
return -EOPNOTSUPP;
} else if (r < 0 && r != -ENOENT) {
"\"val\": \"" + value + "\""
"}";
}
- bufferlist in_bl;
bufferlist out_bl;
- int r = rados.mon_command(cmd, in_bl, &out_bl, nullptr);
+ int r = rados.mon_command(std::move(cmd), {}, &out_bl, nullptr);
if (r == -EINVAL) {
return -EOPNOTSUPP;
} else if (r < 0) {
R"( "format": "json")" \
R"(})";
- bufferlist in_bl;
bufferlist out_bl;
- r = rados.mon_command(cmd, in_bl, &out_bl, nullptr);
+ r = rados.mon_command(std::move(cmd), {}, &out_bl, nullptr);
if (r == -EINVAL) {
ldout(cct, 5) << "caps mismatch for existing user" << dendl;
return -EEXIST;
R"(})";
librados::Rados rados(io_ctx);
- bufferlist in_bl;
std::string ss;
- int r = rados.mon_command(cmd, in_bl, nullptr, &ss);
+ int r = rados.mon_command(std::move(cmd), {}, nullptr, &ss);
if (r < 0) {
lderr(cct) << "failed to notify clients of pool config update: "
<< cpp_strerror(r) << dendl;
return -EINVAL;
}
- librados::bufferlist inbl;
librados::bufferlist outbl;
std::string pool_name = io_ctx.get_pool_name();
librados::Rados rados(io_ctx);
- rados.mon_command(R"({"prefix": "df", "format": "json"})", inbl,
+ rados.mon_command(R"({"prefix": "df", "format": "json"})", {},
&outbl, nullptr);
json_spirit::mValue json;
dout(0) << __func__ << ": sending mon command: " << cmd[0] << dendl;
C_MDS_MonCommand *fin = new C_MDS_MonCommand(this, cmd[0]);
- monc->start_mon_command(cmd, {}, nullptr, &fin->outs, new C_IO_Wrapper(this, fin));
+ monc->start_mon_command(std::move(cmd), {}, nullptr, &fin->outs, new C_IO_Wrapper(this, fin));
already_sent = true;
}
}
};
- auto apply_blocklist = [this, cmd](std::function<void ()> fn){
+ auto apply_blocklist = [this, &cmd](std::function<void ()> fn){
ceph_assert(ceph_mutex_is_locked_by_me(mds_lock));
Context *on_blocklist_done = new LambdaContext([this, fn](int r) {
});
dout(4) << "Sending mon blocklist command: " << cmd[0] << dendl;
- monc->start_mon_command(cmd, {}, nullptr, nullptr, on_blocklist_done);
+ monc->start_mon_command(std::move(cmd), {}, nullptr, nullptr, on_blocklist_done);
};
if (wait) {
"}";
Command set_cmd;
- set_cmd.run(&monc, cmd, json);
+ set_cmd.run(&monc, std::move(cmd), std::move(json));
set_cmd.wait();
}
self->py_modules->get_monc().start_mon_command(
name,
{cmd_json},
- inbuf,
+ std::move(inbuf),
&command_c->outbl,
&command_c->outs,
new C_OnFinisher(c, &self->py_modules->cmd_finisher));
self->py_modules->get_objecter().osd_command(
osd_id,
{cmd_json},
- inbuf,
+ std::move(inbuf),
&tid,
[command_c, f = &self->py_modules->cmd_finisher]
(boost::system::error_code ec, std::string s, ceph::buffer::list bl) {
self->py_modules->get_objecter().pg_command(
pgid,
{cmd_json},
- inbuf,
+ std::move(inbuf),
&tid,
[command_c, f = &self->py_modules->cmd_finisher]
(boost::system::error_code ec, std::string s, ceph::buffer::list bl) {
"}";
op->mark_start_mon_command();
auto on_finish = new ReplyOnFinish(cmdctx, op);
- monc->start_mon_command({cmd}, json, nullptr, nullptr, on_finish);
+ monc->start_mon_command({cmd}, std::move(json), nullptr, nullptr, on_finish);
}
return true;
} else if (prefix == "device rm-life-expectancy") {
}
op->mark_start_mon_command();
auto on_finish = new ReplyOnFinish(cmdctx, op);
- monc->start_mon_command({cmd}, json, nullptr, nullptr, on_finish);
+ monc->start_mon_command({std::move(cmd)}, std::move(json), nullptr, nullptr, on_finish);
} else {
cmdctx->reply(0, ss);
}
return true;
}
-int MgrClient::start_command(const vector<string>& cmd, const bufferlist& inbl,
+int MgrClient::start_command(vector<string>&& cmd, bufferlist&& inbl,
bufferlist *outbl, string *outs,
Context *onfinish)
{
}
auto &op = command_table.start_command();
- op.cmd = cmd;
- op.inbl = inbl;
+ op.cmd = std::move(cmd);
+ op.inbl = std::move(inbl);
op.outbl = outbl;
op.outs = outs;
op.on_finish = onfinish;
}
int MgrClient::start_tell_command(
- const string& name,
- const vector<string>& cmd, const bufferlist& inbl,
+ string&& name,
+ vector<string>&& cmd, bufferlist&& inbl,
bufferlist *outbl, string *outs,
Context *onfinish)
{
auto &op = command_table.start_command();
op.tell = true;
- op.name = name;
- op.cmd = cmd;
- op.inbl = inbl;
+ op.name = std::move(name);
+ op.cmd = std::move(cmd);
+ op.inbl = std::move(inbl);
op.outbl = outbl;
op.outs = outs;
op.on_finish = onfinish;
}
int start_command(
- const std::vector<std::string>& cmd, const ceph::buffer::list& inbl,
+ std::vector<std::string>&& cmd, ceph::buffer::list&& inbl,
ceph::buffer::list *outbl, std::string *outs,
Context *onfinish);
int start_tell_command(
- const std::string& name,
- const std::vector<std::string>& cmd, const ceph::buffer::list& inbl,
+ std::string&& name,
+ std::vector<std::string>&& cmd, ceph::buffer::list&& inbl,
ceph::buffer::list *outbl, std::string *outs,
Context *onfinish);
&outbl, &outs, &cond);
}
- void run(MonClient *monc, const std::string &command, const ceph::buffer::list &inbl)
+ void run(MonClient *monc, const std::string &command, ceph::buffer::list &&inbl)
{
- monc->start_mon_command({command}, inbl,
+ monc->start_mon_command({command}, std::move(inbl),
&outbl, &outs, &cond);
}
CommandCompletion onfinish;
std::optional<boost::asio::steady_timer> cancel_timer;
- MonCommand(MonClient& monc, uint64_t t, CommandCompletion onfinish)
+ MonCommand(MonClient& monc, uint64_t t, CommandCompletion&& onfinish)
: tid(t), onfinish(std::move(onfinish)) {
auto timeout =
monc.cct->_conf.get_val<std::chrono::seconds>("rados_mon_op_timeout");
public:
template<typename CompletionToken>
- auto start_mon_command(std::vector<std::string> cmd,
- ceph::buffer::list inbl,
+ auto start_mon_command(std::vector<std::string>&& cmd,
+ ceph::buffer::list&& inbl,
CompletionToken&& token) {
namespace asio = boost::asio;
ldout(cct,10) << __func__ << " cmd=" << cmd << dendl;
}
template<typename CompletionToken>
- auto start_mon_command(int mon_rank, std::vector<std::string> cmd,
- ceph::buffer::list inbl,
+ auto start_mon_command(int mon_rank, std::vector<std::string>&& cmd,
+ ceph::buffer::list&& inbl,
CompletionToken&& token) {
namespace asio = boost::asio;
namespace sys = boost::system;
}
template<typename CompletionToken>
- auto start_mon_command(std::string mon_name,
- std::vector<std::string> cmd,
- ceph::buffer::list inbl,
+ auto start_mon_command(std::string&& mon_name,
+ std::vector<std::string>&& cmd,
+ ceph::buffer::list&& inbl,
CompletionToken&& token) {
namespace asio = boost::asio;
ldout(cct,10) << __func__ << " cmd=" << cmd << dendl;
ContextVerter& operator =(ContextVerter&&) = default;
void operator()(boost::system::error_code e,
- std::string s,
- ceph::bufferlist bl) {
+ std::string&& s,
+ ceph::bufferlist&& bl) {
if (outs)
*outs = std::move(s);
if (outbl)
}
};
- void start_mon_command(std::vector<std::string> cmd, bufferlist inbl,
+ void start_mon_command(std::vector<std::string> cmd, bufferlist&& inbl,
bufferlist *outbl, std::string *outs,
Context *onfinish) {
start_mon_command(std::move(cmd), std::move(inbl),
ContextVerter(outs, outbl, onfinish));
}
- void start_mon_command(int mon_rank, std::vector<std::string> cmd,
- bufferlist inbl, bufferlist *outbl, std::string *outs,
+ void start_mon_command(int mon_rank, std::vector<std::string>&& cmd,
+ bufferlist&& inbl, bufferlist *outbl, std::string *outs,
Context *onfinish) {
start_mon_command(mon_rank, std::move(cmd), std::move(inbl),
ContextVerter(outs, outbl, onfinish));
}
- void start_mon_command(std::string mon_name, ///< mon name, with mon. prefix
- std::vector<std::string> cmd, bufferlist inbl,
+ void start_mon_command(std::string&& mon_name, ///< mon name, with mon. prefix
+ std::vector<std::string>&& cmd, bufferlist&& inbl,
bufferlist *outbl, std::string *outs,
Context *onfinish) {
start_mon_command(std::move(mon_name), std::move(cmd), std::move(inbl),
dout(10) << __func__ << " proxying mgr command (+" << size
<< " -> " << mgr_proxy_bytes << ")" << dendl;
C_MgrProxyCommand *fin = new C_MgrProxyCommand(this, op, size);
- mgr_client.start_command(m->cmd,
- m->get_data(),
+ mgr_client.start_command(std::move(m->cmd),
+ std::move(m->get_data()),
&fin->outbl,
&fin->outs,
new C_OnFinisher(fin, &finisher));
});
}
-void RADOS::osd_command_(int osd, std::vector<std::string> cmd,
- ceph::bufferlist in, CommandComp c) {
+void RADOS::osd_command_(int osd, std::vector<std::string>&& cmd,
+ ceph::bufferlist&& in, CommandComp c) {
impl->objecter->osd_command(
osd, std::move(cmd), std::move(in), nullptr,
[c = std::move(c)]
});
}
-void RADOS::pg_command_(PG pg, std::vector<std::string> cmd,
- ceph::bufferlist in, CommandComp c) {
+void RADOS::pg_command_(PG pg, std::vector<std::string>&& cmd,
+ ceph::bufferlist&& in, CommandComp c) {
impl->objecter->pg_command(
pg_t{pg.seed, pg.pool}, std::move(cmd), std::move(in), nullptr,
[c = std::move(c)]
impl->objecter->wait_for_latest_osdmap(std::move(c));
}
-void RADOS::mon_command_(std::vector<std::string> command,
- cb::list bl, std::string* outs, cb::list* outbl,
+void RADOS::mon_command_(std::vector<std::string>&& command,
+ cb::list&& bl, std::string* outs, cb::list* outbl,
SimpleOpComp c) {
impl->monclient.start_mon_command(
- command, bl,
+ std::move(command), std::move(bl),
[c = std::move(c), outs, outbl](bs::error_code e,
std::string s, cb::list bl) mutable {
if (outs)
get_parent()->whoami()) + "\"] }";
vector<std::string> vcmd{cmd};
dout(0) << __func__ << " Error inject - marking OSD down" << dendl;
- get_parent()->start_mon_command(vcmd, {}, nullptr, nullptr, nullptr);
+ get_parent()->start_mon_command(std::move(vcmd), {}, nullptr, nullptr, nullptr);
}
if (op->pending_commits == 0) {
"{ \"prefix\": \"osd down\", \"ids\": [\"" + std::to_string( get_parent()->whoami() ) + "\"] }";
vector<std::string> vcmd{cmd};
dout(0) << __func__ << " Error inject - marking OSD down" << dendl;
- get_parent()->start_mon_command(vcmd, {}, nullptr, nullptr, nullptr);
+ get_parent()->start_mon_command(std::move(vcmd), {}, nullptr, nullptr, nullptr);
}
rmw_pipeline.check_ops();
}
return r;
}
-int OSD::mon_cmd_maybe_osd_create(string &cmd)
+int OSD::mon_cmd_maybe_osd_create(string &&cmd)
{
bool created = false;
while (true) {
dout(10) << __func__ << " cmd: " << cmd << dendl;
- vector<string> vcmd{cmd};
- bufferlist inbl;
C_SaferCond w;
string outs;
- monc->start_mon_command(vcmd, inbl, NULL, &outs, &w);
+ monc->start_mon_command({std::move(cmd)}, {}, NULL, &outs, &w);
int r = w.wait();
if (r < 0) {
if (r == -ENOENT && !created) {
string newcmd = "{\"prefix\": \"osd create\", \"id\": " + stringify(whoami)
+ ", \"uuid\": \"" + stringify(superblock.osd_fsid) + "\"}";
- vector<string> vnewcmd{newcmd};
- bufferlist inbl;
C_SaferCond w;
string outs;
- monc->start_mon_command(vnewcmd, inbl, NULL, &outs, &w);
+ monc->start_mon_command({std::move(newcmd)}, {}, NULL, &outs, &w);
int r = w.wait();
if (r < 0) {
derr << __func__ << " fail: osd does not exist and created failed: "
string("\"id\": ") + stringify(whoami) + ", " +
string("\"weight\":") + weight + ", " +
string("\"args\": [") + stringify(cct->crush_location) + "]}";
- return mon_cmd_maybe_osd_create(cmd);
+ return mon_cmd_maybe_osd_create(std::move(cmd));
}
int OSD::update_crush_device_class()
string("\"class\": \"") + device_class + string("\", ") +
string("\"ids\": [\"") + stringify(whoami) + string("\"]}");
- r = mon_cmd_maybe_osd_create(cmd);
+ r = mon_cmd_maybe_osd_create(std::move(cmd));
if (r == -EBUSY) {
// good, already bound to a device-class
return 0;
"\"who\": \"" + osd + "\", "
"\"name\": \"" + key + "\""
"}";
- vector<std::string> vcmd{cmd};
dout(1) << __func__ << " Removing Key: " << key
<< " for " << osd << " from Mon db" << dendl;
- monc->start_mon_command(vcmd, {}, nullptr, nullptr, nullptr);
+ monc->start_mon_command({std::move(cmd)}, {}, nullptr, nullptr, nullptr);
}
// Raise a cluster warning indicating that the changes did not
"\"name\": \"" + key + "\", "
"\"value\": \"" + val + "\""
"}";
- vector<std::string> vcmd{cmd};
auto on_finish = new MonCmdSetConfigOnFinish(this, cct, key, val);
dout(10) << __func__ << " Set " << key << " = " << val << dendl;
- monc->start_mon_command(vcmd, {}, nullptr, nullptr, on_finish);
+ monc->start_mon_command({std::move(cmd)}, {}, nullptr, nullptr, on_finish);
}
op_queue_type_t OSD::osd_op_queue_type() const
}
private:
- int mon_cmd_maybe_osd_create(std::string &cmd);
+ int mon_cmd_maybe_osd_create(std::string &&cmd);
int update_crush_device_class();
int update_crush_location();
virtual void send_message_osd_cluster(
Message *m, const ConnectionRef& con) = 0;
virtual void start_mon_command(
- const std::vector<std::string>& cmd, const bufferlist& inbl,
+ std::vector<std::string>&& cmd, bufferlist&& inbl,
bufferlist *outbl, std::string *outs,
Context *onfinish) = 0;
virtual ConnectionRef get_con_osd_cluster(int peer, epoch_t from_epoch) = 0;
osd->send_message_osd_cluster(m, con);
}
void start_mon_command(
- const std::vector<std::string>& cmd, const bufferlist& inbl,
+ std::vector<std::string>&& cmd, bufferlist&& inbl,
bufferlist *outbl, std::string *outs,
Context *onfinish) override {
- osd->monc->start_mon_command(cmd, inbl, outbl, outs, onfinish);
+ osd->monc->start_mon_command(std::move(cmd), std::move(inbl), outbl, outs, onfinish);
}
ConnectionRef get_con_osd_cluster(int peer, epoch_t from_epoch) override;
entity_name_t get_cluster_msgr_name() override {
epoch_t op_cancel_writes(int r, int64_t pool=-1);
// commands
- void osd_command_(int osd, std::vector<std::string> cmd,
- ceph::buffer::list inbl, ceph_tid_t *ptid,
+ void osd_command_(int osd, std::vector<std::string>&& cmd,
+ ceph::buffer::list&& inbl, ceph_tid_t *ptid,
decltype(CommandOp::onfinish)&& onfinish) {
ceph_assert(osd >= 0);
auto c = new CommandOp(
submit_command(c, ptid);
}
template<typename CompletionToken>
- auto osd_command(int osd, std::vector<std::string> cmd,
- ceph::buffer::list inbl, ceph_tid_t *ptid,
+ auto osd_command(int osd, std::vector<std::string>&& cmd,
+ ceph::buffer::list&& inbl, ceph_tid_t *ptid,
CompletionToken&& token) {
auto consigned = boost::asio::consign(
std::forward<CompletionToken>(token), boost::asio::make_work_guard(
service.get_executor()));
return boost::asio::async_initiate<decltype(consigned), CommandOp::OpSig>(
[osd, cmd = std::move(cmd), inbl = std::move(inbl), ptid, this]
- (auto handler) {
+ (auto handler) mutable {
osd_command_(osd, std::move(cmd), std::move(inbl), ptid,
std::move(handler));
}, consigned);
}
- void pg_command_(pg_t pgid, std::vector<std::string> cmd,
- ceph::buffer::list inbl, ceph_tid_t *ptid,
+ void pg_command_(pg_t pgid, std::vector<std::string>&& cmd,
+ ceph::buffer::list&& inbl, ceph_tid_t *ptid,
decltype(CommandOp::onfinish)&& onfinish) {
auto *c = new CommandOp(
pgid,
}
template<typename CompletionToken>
- auto pg_command(pg_t pgid, std::vector<std::string> cmd,
- ceph::buffer::list inbl, ceph_tid_t *ptid,
+ auto pg_command(pg_t pgid, std::vector<std::string>&& cmd,
+ ceph::buffer::list&& inbl, ceph_tid_t *ptid,
CompletionToken&& token) {
auto consigned = boost::asio::consign(
std::forward<CompletionToken>(token), boost::asio::make_work_guard(service.get_executor()));
return async_initiate<decltype(consigned), CommandOp::OpSig> (
[pgid, cmd = std::move(cmd), inbl = std::move(inbl), ptid, this]
- (auto handler) {
+ (auto handler) mutable {
pg_command_(pgid, std::move(cmd), std::move(inbl), ptid,
std::move(handler));
}, consigned);
// temporary solution until we find a way to disable the health warn on replica1
std::string replica_count(std::to_string(2));
#endif
- librados::bufferlist inbl;
std::string output;
std::string command = R"(
{
})";
auto rados_handle = store->getRados()->get_rados_handle();
- int ret = rados_handle->mon_command(command, inbl, nullptr, &output);
+ int ret = rados_handle->mon_command(std::move(command), {}, nullptr, &output);
if (output.length()) {
if (output != "pool 'rgw_dedup_pool' already exists") {
ldpp_dout(dpp, 10) << __func__ << "::" << output << dendl;
if (mostly_omap) {
// set pg_autoscale_bias
- bufferlist inbl;
float bias = g_conf().get_val<double>("rgw_rados_pool_autoscale_bias");
int r = rados->mon_command(
"{\"prefix\": \"osd pool set\", \"pool\": \"" +
pool.name + "\", \"var\": \"pg_autoscale_bias\", \"val\": \"" +
stringify(bias) + "\"}",
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (r < 0) {
ldpp_dout(dpp, 10) << __func__ << " warning: failed to set pg_autoscale_bias on "
<< pool.name << dendl;
"{\"prefix\": \"osd pool set\", \"pool\": \"" +
pool.name + "\", \"var\": \"recovery_priority\": \"" +
stringify(p) + "\"}",
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (r < 0) {
ldpp_dout(dpp, 10) << __func__ << " warning: failed to set recovery_priority on "
<< pool.name << dendl;
}
if (bulk) {
// set bulk
- bufferlist inbl;
int r = rados->mon_command(
"{\"prefix\": \"osd pool set\", \"pool\": \"" +
pool.name + "\", \"var\": \"bulk\", \"val\": \"true\"}",
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (r < 0) {
ldpp_dout(dpp, 10) << __func__ << " warning: failed to set 'bulk' on "
<< pool.name << dendl;
"\"logtext\": [\"" + msg + "\"]"
"}";
- bufferlist inbl;
- return h->mon_command(cmd, inbl, nullptr, nullptr);
+ return h->mon_command(std::move(cmd), {}, nullptr, nullptr);
}
int rgw_list_pool(const DoutPrefixProvider *dpp,
"\"key\": \"" + key + "\""
"}";
- bufferlist inbl;
- int ret = rados->mon_command(cmd, inbl, result, nullptr);
+ int ret = rados->mon_command(std::move(cmd), {}, result, nullptr);
if (ret < 0) {
return ret;
}
static std::string _get_required_osd_release(Rados& cluster)
{
- bufferlist inbl;
std::string cmd = std::string("{\"prefix\": \"osd dump\",\"format\":\"json\"}");
bufferlist outbl;
- int r = cluster.mon_command(cmd, inbl, &outbl, NULL);
+ int r = cluster.mon_command(std::move(cmd), {}, &outbl, NULL);
ceph_assert(r >= 0);
std::string outstr(outbl.c_str(), outbl.length());
json_spirit::Value v;
"size": )" + to_string(conf.replica_count) +
R"(
})";
- librados::bufferlist inbl;
string output;
- ret = rados.mon_command(command, inbl, nullptr, &output);
+ ret = rados.mon_command(std::move(command), {}, nullptr, &output);
if (output.length()) cout << output << endl;
if (ret < 0) {
ret = -ret;
sleep(5);
string command = R"({"prefix": "osd deep-scrub", "who": "all"})";
- auto output = get_output(command);
+ auto output = get_output(std::move(command));
cout << output << endl;
cout << "Waiting for deep-scrub to complete..." << endl;
return x;
}
-const string LazyOmapStatsTest::get_output(const string command,
+const string LazyOmapStatsTest::get_output(std::string&& command,
const bool silent,
const CommandTarget target)
{
- librados::bufferlist inbl, outbl;
+ librados::bufferlist outbl;
string output;
int ret = 0;
if (target == CommandTarget::TARGET_MON) {
- ret = rados.mon_command(command, inbl, &outbl, &output);
+ ret = rados.mon_command(std::move(command), {}, &outbl, &output);
} else {
- ret = rados.mgr_command(command, inbl, &outbl, &output);
+ ret = rados.mgr_command(std::move(command), {}, &outbl, &output);
}
if (output.length() && !silent) {
cout << output << endl;
string command = R"({"prefix": "osd pool ls", "detail": "detail", "format": "json"})";
librados::bufferlist inbl, outbl;
- auto output = get_output(command, false, CommandTarget::TARGET_MON);
+ auto output = get_output(std::move(command), false, CommandTarget::TARGET_MON);
JSONParser parser;
parser.parse(output.c_str(), output.size());
for (const auto& pool : parser.get_array_elements()) {
map<string, string> LazyOmapStatsTest::get_scrub_stamps() {
map<string, string> stamps;
string command = R"({"prefix": "pg dump", "format": "json"})";
- auto output = get_output(command);
+ auto output = get_output(std::move(command));
JSONParser parser;
parser.parse(output.c_str(), output.size());
auto* obj = parser.find_obj("pg_map")->find_obj("pg_stats");
cout << R"(Checking "pg dump summary" output)" << endl;
string command = R"({"prefix": "pg dump", "dumpcontents": ["summary"]})";
- string dump_output = get_output(command);
+ string dump_output = get_output(std::move(command));
cout << dump_output << endl;
boost::regex reg(
cout << R"(Checking "pg dump pgs" output)" << endl;
string command = R"({"prefix": "pg dump", "dumpcontents": ["pgs"]})";
- string dump_output = get_output(command);
+ string dump_output = get_output(std::move(command));
cout << dump_output << endl;
boost::regex reg(R"(^(PG_STAT\s.*))"
cout << R"(Checking "pg dump pools" output)" << endl;
string command = R"({"prefix": "pg dump", "dumpcontents": ["pools"]})";
- string dump_output = get_output(command);
+ string dump_output = get_output(std::move(command));
cout << dump_output << endl;
boost::regex reg(R"(^(POOLID\s.*))"
cout << R"(Checking "pg ls" output)" << endl;
string command = R"({"prefix": "pg ls"})";
- string dump_output = get_output(command);
+ string dump_output = get_output(std::move(command));
cout << dump_output << endl;
boost::regex reg(R"(^(PG\s.*))"
string command = R"({"prefix": "pg dump"})";
int num_not_clean;
do {
- string dump_output = get_output(command, true);
+ string dump_output = get_output(std::move(command), true);
if (index == -1) {
boost::regex ireg(
"\n"
void check_pg_dump_pools();
void check_pg_ls();
const std::string get_output(
- const std::string command = R"({"prefix": "pg dump"})",
+ std::string&& command = R"({"prefix": "pg dump"})",
const bool silent = false,
const CommandTarget target = CommandTarget::TARGET_MGR);
void get_pool_id(const std::string& pool);
ASSERT_EQ(0, test_data.m_cluster.ioctx_create(p.c_str(), ioctx));
ioctx.application_enable("rados", true);
- bufferlist inbl;
ASSERT_EQ(0, test_data.m_cluster.mon_command(
"{\"prefix\": \"osd pool set-quota\", \"pool\": \"" + p +
"\", \"field\": \"max_bytes\", \"val\": \"4096\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
bufferlist bl;
bufferptr z(4096);
if (i == max / 2) {
t = new std::thread([&] {
- bufferlist empty;
cout << "sending pool EIO time: " << ceph_clock_now() << std::endl;
ASSERT_EQ(0, test_data.m_cluster.mon_command(
fmt::format(R"({{
"var": "eio",
"val": "true"
}})", test_data.m_pool_name),
- empty, nullptr, nullptr));
+ {}, nullptr, nullptr));
{
std::scoped_lock lk(my_lock);
TEST(LibRadosCmd, MonDescribePP) {
Rados cluster;
ASSERT_EQ("", connect_cluster_pp(cluster));
- bufferlist inbl, outbl;
+ bufferlist outbl;
string outs;
ASSERT_EQ(0, cluster.mon_command("{\"prefix\": \"get_command_descriptions\"}",
- inbl, &outbl, &outs));
+ {}, &outbl, &outs));
ASSERT_LT(0u, outbl.length());
ASSERT_LE(0u, outs.length());
cluster.shutdown();
Rados cluster;
ASSERT_EQ("", connect_cluster_pp(cluster));
int r;
- bufferlist inbl, outbl;
+ bufferlist outbl;
string outs;
string cmd;
// note: tolerate NXIO here in case the cluster is thrashing out underneath us.
cmd = "asdfasdf";
- r = cluster.osd_command(0, cmd, inbl, &outbl, &outs);
+ r = cluster.osd_command(0, std::move(cmd), {}, &outbl, &outs);
ASSERT_TRUE(r == -22 || r == -ENXIO);
cmd = "version";
- r = cluster.osd_command(0, cmd, inbl, &outbl, &outs);
+ r = cluster.osd_command(0, std::move(cmd), {}, &outbl, &outs);
ASSERT_TRUE(r == -22 || r == -ENXIO);
cmd = "{\"prefix\":\"version\"}";
- r = cluster.osd_command(0, cmd, inbl, &outbl, &outs);
+ r = cluster.osd_command(0, std::move(cmd), {}, &outbl, &outs);
ASSERT_TRUE((r == 0 && outbl.length() > 0) || (r == -ENXIO && outbl.length() == 0));
cluster.shutdown();
}
ASSERT_EQ("", create_one_pool_pp(pool_name, cluster));
int r;
- bufferlist inbl, outbl;
+ bufferlist outbl;
string outs;
string cmd;
cmd = "asdfasdf";
// note: tolerate NXIO here in case the cluster is thrashing out underneath us.
- r = cluster.pg_command(pgid.c_str(), cmd, inbl, &outbl, &outs);
+ r = cluster.pg_command(pgid.c_str(), std::move(cmd), {}, &outbl, &outs);
ASSERT_TRUE(r == -22 || r == -ENXIO);
// make sure the pg exists on the osd before we query it
cmd = "{\"prefix\":\"pg\", \"cmd\":\"query\", \"pgid\":\"" + pgid + "\"}";
// note: tolerate ENOENT/ENXIO here if hte osd is thrashing out underneath us
- r = cluster.pg_command(pgid.c_str(), cmd, inbl, &outbl, &outs);
+ r = cluster.pg_command(pgid.c_str(), std::move(cmd), {}, &outbl, &outs);
ASSERT_TRUE(r == 0 || r == -ENOENT || r == -ENXIO);
ASSERT_LT(0u, outbl.length());
TEST_F(LibRadosMiscPP, CopyScrubPP) {
SKIP_IF_CRIMSON();
- bufferlist inbl, bl, x;
+ bufferlist bl, x;
for (int i=0; i<100; ++i)
x.append("barrrrrrrrrrrrrrrrrrrrrrrrrr");
bl.append(buffer::create(g_conf()->osd_copyfrom_max_chunk * 3));
ss << "{\"prefix\": \"pg deep-scrub\", \"pgid\": \""
<< ioctx.get_id() << "." << i
<< "\"}";
- cluster.mon_command(ss.str(), inbl, NULL, NULL);
+ cluster.mon_command(ss.str(), {}, NULL, NULL);
}
// give it a few seconds to go. this is sloppy but is usually enough time
ss << "{\"prefix\": \"pg deep-scrub\", \"pgid\": \""
<< ioctx.get_id() << "." << i
<< "\"}";
- cluster.mon_command(ss.str(), inbl, NULL, NULL);
+ cluster.mon_command(ss.str(), {}, NULL, NULL);
}
// give it a few seconds to go. this is sloppy but is usually enough time
}
TEST_F(LibRadosMiscPP, Applications) {
- bufferlist inbl, outbl;
+ bufferlist outbl;
string outs;
ASSERT_EQ(0, cluster.mon_command("{\"prefix\": \"osd dump\"}",
- inbl, &outbl, &outs));
+ {}, &outbl, &outs));
ASSERT_LT(0u, outbl.length());
ASSERT_LE(0u, outs.length());
if (!std::regex_search(outbl.to_str(),
ASSERT_EQ(0, cluster.conf_read_file(NULL));
cluster.conf_parse_env(NULL);
ASSERT_EQ(0, cluster.connect());
- bufferlist inbl, outbl;
+ bufferlist outbl;
ASSERT_EQ(0, cluster.mon_command("{\"prefix\": \"service dump\"}",
- inbl, &outbl, NULL));
+ {}, &outbl, NULL));
string s = outbl.to_str();
cluster.shutdown();
"\"value\": \"off\""
"}";
std::cout << "Setting pg_autoscaler to 'off'" << std::endl;
- bufferlist inbl;
bufferlist outbl;
- ASSERT_EQ(0, s_cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, s_cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
// disable scrubs for the test
cmd = "{\"prefix\": \"osd set\",\"key\":\"noscrub\"}";
- ASSERT_EQ(0, s_cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, s_cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
cmd = "{\"prefix\": \"osd set\",\"key\":\"nodeep-scrub\"}";
- ASSERT_EQ(0, s_cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, s_cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
RadosTestPP::SetUp();
}
"\"value\": \"on\""
"}";
std::cout << "Setting pg_autoscaler to 'on'" << std::endl;
- bufferlist inbl;
bufferlist outbl;
- ASSERT_EQ(0, s_cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, s_cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
// re-enable scrubs
cmd = "{\"prefix\": \"osd unset\",\"key\":\"noscrub\"}";
- ASSERT_EQ(0, s_cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, s_cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
cmd = string("{\"prefix\": \"osd unset\",\"key\":\"nodeep-scrub\"}");
- ASSERT_EQ(0, s_cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, s_cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
RadosTestPP::TearDown();
}
"\"value\": \"off\""
"}";
std::cout << "Setting pg_autoscaler to 'off'" << std::endl;
- bufferlist inbl;
bufferlist outbl;
- ASSERT_EQ(0, s_cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, s_cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
// disable scrubs for the test
cmd = string("{\"prefix\": \"osd set\",\"key\":\"noscrub\"}");
- ASSERT_EQ(0, s_cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, s_cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
cmd = string("{\"prefix\": \"osd set\",\"key\":\"nodeep-scrub\"}");
- ASSERT_EQ(0, s_cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, s_cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
RadosTestECPP::SetUp();
}
"\"value\": \"on\""
"}";
std::cout << "Setting pg_autoscaler to 'on'" << std::endl;
- bufferlist inbl;
bufferlist outbl;
- ASSERT_EQ(0, s_cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, s_cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
// re-enable scrubs
cmd = string("{\"prefix\": \"osd unset\",\"key\":\"noscrub\"}");
- ASSERT_EQ(0, s_cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, s_cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
cmd = string("{\"prefix\": \"osd unset\",\"key\":\"nodeep-scrub\"}");
- ASSERT_EQ(0, s_cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, s_cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
RadosTestECPP::TearDown();
}
int tries = 0;
do {
string cmd = string("{\"prefix\": \"pg dump\",\"format\":\"json\"}");
- bufferlist inbl;
bufferlist outbl;
- ASSERT_EQ(0, cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
string outstr(outbl.c_str(), outbl.length());
json_spirit::Value v;
ASSERT_NE(0, json_spirit::read(outstr, v)) << "unable to parse json." << '\n' << outstr;
int tries = 0;
do {
string cmd = string("{\"prefix\": \"pg dump\",\"format\":\"json\"}");
- bufferlist inbl;
bufferlist outbl;
- ASSERT_EQ(0, cluster.mon_command(cmd, inbl, &outbl, NULL));
+ ASSERT_EQ(0, cluster.mon_command(std::move(cmd), {}, &outbl, NULL));
string outstr(outbl.c_str(), outbl.length());
json_spirit::Value v;
ASSERT_NE(0, json_spirit::read(outstr, v)) << "unable to parse json." << '\n' << outstr;
const std::string &rule,
std::ostream &oss)
{
- bufferlist inbl;
int ret = cluster.mon_command("{\"prefix\": \"osd crush rule rm\", \"name\":\"" +
- rule + "\"}", inbl, NULL, NULL);
+ rule + "\"}", {}, NULL, NULL);
if (ret)
oss << "mon_command: osd crush rule rm " + rule + " failed with error " << ret << std::endl;
return ret;
int destroy_ec_profile_pp(Rados &cluster, const std::string& pool_name,
std::ostream &oss)
{
- bufferlist inbl;
int ret = cluster.mon_command("{\"prefix\": \"osd erasure-code-profile rm\", \"name\": \"testprofile-" + pool_name + "\"}",
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (ret)
oss << "mon_command: osd erasure-code-profile rm testprofile-" << pool_name << " failed with error " << ret << std::endl;
return ret;
return oss.str();
}
- bufferlist inbl;
ret = cluster.mon_command(
"{\"prefix\": \"osd erasure-code-profile set\", \"name\": \"testprofile-" + pool_name + "\", \"profile\": [ \"k=2\", \"m=1\", \"crush-failure-domain=osd\"]}",
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (ret) {
cluster.shutdown();
oss << "mon_command erasure-code-profile set name:testprofile-" << pool_name << " failed with error " << ret;
ret = cluster.mon_command(
"{\"prefix\": \"osd pool create\", \"pool\": \"" + pool_name + "\", \"pool_type\":\"erasure\", \"pg_num\":8, \"pgp_num\":8, \"erasure_code_profile\":\"testprofile-" + pool_name + "\"}",
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (ret) {
- bufferlist inbl;
destroy_ec_profile_pp(cluster, pool_name, oss);
cluster.shutdown();
oss << "mon_command osd pool create pool:" << pool_name << " pool_type:erasure failed with error " << ret;
std::string set_allow_ec_overwrites_pp(const std::string &pool_name, Rados &cluster, bool allow)
{
std::ostringstream oss;
- bufferlist inbl;
int ret = cluster.mon_command(
"{\"prefix\": \"osd pool set\", \"pool\": \"" + pool_name + "\", \"var\": \"allow_ec_overwrites\", \"val\": \"" + (allow ? "true" : "false") + "\"}",
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (ret) {
cluster.shutdown();
oss << "mon_command osd pool set pool:" << pool_name << " pool_type:erasure allow_ec_overwrites true failed with error " << ret;
{
if (cache_pool_name.length()) {
// tear down tiers
- bufferlist inbl;
ASSERT_EQ(0, s_cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, s_cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, s_cluster.mon_command(
"{\"prefix\": \"osd pool delete\", \"pool\": \"" + cache_pool_name +
"\", \"pool2\": \"" + cache_pool_name + "\", \"yes_i_really_really_mean_it\": true}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
cache_pool_name = "";
}
ASSERT_EQ(0, destroy_one_pool_pp(pool_name, s_cluster));
cache_pool_name.empty()) {
auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name());
cache_pool_name = get_temp_pool_name();
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd pool create\", \"pool\": \"" + cache_pool_name +
"\", \"pg_num\": 4}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
cluster.wait_for_latest_osdmap();
}
{
if (cache_pool_name.length()) {
// tear down tiers
- bufferlist inbl;
ASSERT_EQ(0, s_cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, s_cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, s_cluster.mon_command(
"{\"prefix\": \"osd pool delete\", \"pool\": \"" + cache_pool_name +
"\", \"pool2\": \"" + cache_pool_name + "\", \"yes_i_really_really_mean_it\": true}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
cache_pool_name = "";
}
ASSERT_EQ(0, destroy_one_pool_pp(pool_name, s_cluster));
cache_pool_name.empty()) {
auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name());
cache_pool_name = get_temp_pool_name();
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd pool create\", \"pool\": \"" + cache_pool_name +
"\", \"pg_num\": 4}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
cluster.wait_for_latest_osdmap();
}
void flush_evict_all(librados::Rados& cluster, librados::IoCtx& cache_ioctx)
{
- bufferlist inbl;
cache_ioctx.set_namespace(all_nspaces);
for (NObjectIterator it = cache_ioctx.nobjects_begin();
it != cache_ioctx.nobjects_end(); ++it) {
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);
+ int r = cluster.mon_command(std::move(cmd), {}, &outbl, NULL);
ceph_assert(r >= 0);
string outstr(outbl.c_str(), outbl.length());
json_spirit::Value v;
// flush + evict cache
flush_evict_all(cluster, cache_ioctx);
- bufferlist inbl;
// tear down tiers
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle before next test
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ss << "{\"prefix\": \"pg scrub\", \"pgid\": \""
<< cache_ioctx.get_id() << "." << i
<< "\"}";
- int r = cluster.mon_command(ss.str(), inbl, NULL, NULL);
+ int r = cluster.mon_command(ss.str(), {}, NULL, NULL);
if (r == -ENOENT || // in case mgr osdmap is stale
r == -EAGAIN) {
sleep(5);
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsPP, WhiteoutDeleteCreate) {
SKIP_IF_CRIMSON();
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, ioctx.operate("foo", &op));
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// Configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// Wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsPP, TryFlush) {
SKIP_IF_CRIMSON();
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsPP, Flush) {
SKIP_IF_CRIMSON();
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsPP, FlushSnap) {
SKIP_IF_CRIMSON();
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// cleanup
ioctx.selfmanaged_snap_remove(my_snaps[0]);
ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx));
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle before next test
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsPP, FlushTryFlushRaces) {
SKIP_IF_CRIMSON();
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsPP, TryFlushReadRace) {
SKIP_IF_CRIMSON();
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsPP, HitSetRead) {
SKIP_IF_CRIMSON();
// make it a tier
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// enable hitset tracking for this pool
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_count", 2),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_period", 600),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_type",
"explicit_object"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
static int _get_pg_num(Rados& cluster, string pool_name)
{
- bufferlist inbl;
string cmd = string("{\"prefix\": \"osd pool get\",\"pool\":\"")
+ pool_name
+ string("\",\"var\": \"pg_num\",\"format\": \"json\"}");
bufferlist outbl;
- int r = cluster.mon_command(cmd, inbl, &outbl, NULL);
+ int r = cluster.mon_command(std::move(cmd), {}, &outbl, NULL);
ceph_assert(r >= 0);
string outstr(outbl.c_str(), outbl.length());
json_spirit::Value v;
ceph_assert(num_pg > 0);
// make it a tier
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// enable hitset tracking for this pool
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_count", 8),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_period", 600),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_type",
"explicit_hash"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
unsigned period = 3;
// make it a tier
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// enable hitset tracking for this pool
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_count", count),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_period", period),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_type", "bloom"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_fpp", ".01"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// enable hitset tracking for this pool
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_count", 2),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_period", 600),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_type", "bloom"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "min_read_recency_for_promote", 1),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_grade_decay_rate", 20),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_search_last_n", 1),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle before next test
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"readproxy\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle before next test
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
// enable agent
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_count", 2),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_period", 600),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_type", "bloom"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "min_read_recency_for_promote", 1),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "target_max_objects", 1),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
sleep(10);
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle before next test
cluster.wait_for_latest_osdmap();
GTEST_SKIP() << "cluster is not yet nautilus, skipping test";
}
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(pool_name, "fingerprint_algorithm", "sha1"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
cluster.wait_for_latest_osdmap();
string tgt_oid;
return;
}
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(pool_name, "fingerprint_algorithm", "sha1"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
cluster.wait_for_latest_osdmap();
// create object
return;
}
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(pool_name, "fingerprint_algorithm", "sha1"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
cluster.wait_for_latest_osdmap();
// create object
GTEST_SKIP() << "cluster is not yet octopus, skipping test";
}
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(pool_name, "fingerprint_algorithm", "sha1"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
cluster.wait_for_latest_osdmap();
// create object
// scrub
{
for (int tries = 0; tries < 5; ++tries) {
- bufferlist inbl;
ostringstream ss;
ss << "{\"prefix\": \"pg deep-scrub\", \"pgid\": \""
<< cache_ioctx.get_id() << "."
<< std::hex << hash
<< "\"}";
- int r = cluster.mon_command(ss.str(), inbl, NULL, NULL);
+ int r = cluster.mon_command(ss.str(), {}, NULL, NULL);
if (r == -ENOENT ||
r == -EAGAIN) {
sleep(5);
GTEST_SKIP() << "cluster is not yet octopus, skipping test";
}
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "fingerprint_algorithm", "sha1"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_tier", pool_name),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_chunk_algorithm", "fastcdc"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_cdc_chunk_size", 1024),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_cdc_chunk_size", 512),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
cluster.wait_for_latest_osdmap();
// make a dirty chunks
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_cdc_chunk_size", 16384),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
cluster.wait_for_latest_osdmap();
// make a dirty chunks
// less than object size
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_cdc_chunk_size", 1024),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
cluster.wait_for_latest_osdmap();
// make a dirty chunks
return;
}
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "fingerprint_algorithm", "sha1"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_tier", pool_name),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_chunk_algorithm", "fastcdc"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_cdc_chunk_size", 1024),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
return;
}
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "fingerprint_algorithm", "sha1"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_tier", pool_name),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_chunk_algorithm", "fastcdc"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_cdc_chunk_size", 1024),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// create object
bufferlist gbl;
return;
}
- bufferlist inbl;
-
// create a new pool
std::string temp_pool_name = get_temp_pool_name() + "-test-flush";
ASSERT_EQ(0, cluster.pool_create(temp_pool_name.c_str()));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "fingerprint_algorithm", "sha1"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_tier", temp_pool_name),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_chunk_algorithm", "fastcdc"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_cdc_chunk_size", 1024),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// create object
bufferlist gbl;
return;
}
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(pool_name, "fingerprint_algorithm", "sha1"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
cluster.wait_for_latest_osdmap();
// create object
// flush + evict cache
flush_evict_all(cluster, cache_ioctx);
- bufferlist inbl;
// tear down tiers
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle before next test
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
<< cache_ioctx.get_id() << "."
<< hash
<< "\"}";
- int r = cluster.mon_command(ss.str(), inbl, NULL, NULL);
+ int r = cluster.mon_command(ss.str(), {}, NULL, NULL);
if (r == -EAGAIN ||
r == -ENOENT) { // in case mgr osdmap is a bit stale
sleep(5);
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsECPP, TryFlush) {
SKIP_IF_CRIMSON();
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsECPP, FailedFlush) {
SKIP_IF_CRIMSON();
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsECPP, Flush) {
SKIP_IF_CRIMSON();
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsECPP, FlushSnap) {
SKIP_IF_CRIMSON();
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
cluster.wait_for_latest_osdmap();
// cleanup
ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx));
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle before next test
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsECPP, FlushTryFlushRaces) {
SKIP_IF_CRIMSON();
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsECPP, TryFlushReadRace) {
SKIP_IF_CRIMSON();
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx));
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// set things up such that the op would normally be proxied
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_count", 2),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_period", 600),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_type",
"explicit_object"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "min_read_recency_for_promote",
"4"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle before next test
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsECPP, HitSetRead) {
SKIP_IF_CRIMSON();
// make it a tier
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// enable hitset tracking for this pool
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_count", 2),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_period", 600),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_type",
"explicit_object"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ceph_assert(num_pg > 0);
// enable hitset tracking for this pool
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(set_pool_str(pool_name, "hit_set_count", 8),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(pool_name, "hit_set_period", 600),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(pool_name, "hit_set_type",
"explicit_hash"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
unsigned period = 3;
// make it a tier
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// enable hitset tracking for this pool
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_count", count),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_period", period),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_type", "bloom"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(set_pool_str(cache_pool_name, "hit_set_fpp", ".01"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// enable hitset tracking for this pool
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_count", 2),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_period", 600),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_type", "bloom"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "min_read_recency_for_promote", 1),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_grade_decay_rate", 20),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_search_last_n", 1),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle before next test
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"readproxy\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle before next test
cluster.wait_for_latest_osdmap();
}
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
// enable agent
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_count", 2),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_period", 600),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_type", "bloom"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "min_read_recency_for_promote", 1),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "target_max_objects", 1),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
sleep(10);
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove-overlay\", \"pool\": \"" + pool_name +
"\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle before next test
cluster.wait_for_latest_osdmap();
}
// configure tier
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle before next test
cluster.wait_for_latest_osdmap();
SKIP_IF_CRIMSON();
// note: require >= mimic
- bufferlist inbl;
ASSERT_EQ(-EOPNOTSUPP, cluster.mon_command(
set_pool_str(pool_name, "dedup_tier", cache_pool_name),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
}
TEST_F(LibRadosTwoPoolsPP, PropagateBaseTierError) {
ASSERT_EQ(0, ioctx.operate("propagate-base-tier-error", &op1));
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_type", "bloom"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_count", 1),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_period", 600),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "target_max_objects", 250),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
TEST_F(LibRadosTwoPoolsPP, HelloWriteReturn) {
SKIP_IF_CRIMSON();
// configure cache
- bufferlist inbl;
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
"\", \"tierpool\": \"" + cache_pool_name +
"\", \"force_nonempty\": \"--force-nonempty\" }",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier set-overlay\", \"pool\": \"" + pool_name +
"\", \"overlaypool\": \"" + cache_pool_name + "\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
"{\"prefix\": \"osd tier cache-mode\", \"pool\": \"" + cache_pool_name +
"\", \"mode\": \"writeback\"}",
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// set things up such that the op would normally be proxied
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_count", 2),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_period", 600),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "hit_set_type",
"explicit_object"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "min_read_recency_for_promote",
"10000"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// wait for maps to settle
cluster.wait_for_latest_osdmap();
return;
}
- bufferlist inbl;
-
// set dedup parameters without dedup_tier
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "fingerprint_algorithm", "sha1"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_chunk_algorithm", "fastcdc"),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
ASSERT_EQ(0, cluster.mon_command(
set_pool_str(cache_pool_name, "dedup_cdc_chunk_size", 1024),
- inbl, NULL, NULL));
+ {}, NULL, NULL));
// create object
bufferlist gbl;
return 0;
}
-int Rados::mon_command(std::string cmd, const bufferlist& inbl,
+int Rados::mon_command(std::string&& cmd, bufferlist&& inbl,
bufferlist *outbl, std::string *outs) {
TestRadosClient *impl = reinterpret_cast<TestRadosClient*>(client);
- std::vector<std::string> cmds;
- cmds.push_back(cmd);
- return impl->mon_command(cmds, inbl, outbl, outs);
+ return impl->mon_command({std::move(cmd)}, std::move(inbl), outbl, outs);
}
int Rados::service_daemon_register(const std::string& service,
ceph_assert(r == 0);
}
-void RADOS::mon_command_(std::vector<std::string> command,
- bufferlist bl,
+void RADOS::mon_command_(std::vector<std::string>&& command,
+ bufferlist&& bl,
std::string* outs, bufferlist* outbl,
Op::Completion c) {
- auto r = impl->test_rados_client->mon_command(command, bl, outbl, outs);
+ auto r = impl->test_rados_client->mon_command(std::move(command), std::move(bl), outbl, outs);
asio::post(get_executor(),
asio::append(std::move(c),
(r < 0 ? bs::error_code(-r, osd_category()) :
test_erasure(Rados &cluster, const std::string &pool_name, const std::string &obj_name)
{
string outs;
- bufferlist inbl;
int ret;
ret = cluster.mon_command(
"{\"prefix\": \"osd erasure-code-profile set\", \"name\": \"testprofile\", \"profile\": [ \"k=2\", \"m=1\", \"crush-failure-domain=osd\"]}",
- inbl, NULL, &outs);
+ {}, NULL, &outs);
if (ret < 0) {
std::cerr << "mon_command erasure-code-profile set failed with " << ret << std::endl;
exit(1);
outs.clear();
ret = cluster.mon_command(
"{\"prefix\": \"osd pool create\", \"pool\": \"" + pool_name + "\", \"pool_type\":\"erasure\", \"pg_num\":12, \"pgp_num\":12, \"erasure_code_profile\":\"testprofile\"}",
- inbl, NULL, &outs);
+ {}, NULL, &outs);
if (ret < 0) {
std::cerr << outs << std::endl;
std::cerr << "mon_command create pool failed with " << ret << std::endl;
return r;
}
}
- bufferlist inbl;
r = rados.mon_command(
"{\"prefix\": \"osd pool set\", \"pool\": \"" + pool_name +
"\", \"var\": \"write_fadvise_dontneed\", \"val\": \"" + (write_fadvise_dontneed ? "true" : "false") + "\"}",
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (r < 0) {
rados.shutdown();
return r;
r = rados.mon_command(
"{\"prefix\": \"osd pool set\", \"pool\": \"" + pool_name +
"\", \"var\": \"fingerprint_algorithm\", \"val\": \"" + "sha256" + "\"}",
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (r < 0) {
rados.shutdown();
return r;
r = rados.mon_command(
"{\"prefix\": \"osd pool set\", \"pool\": \"" + pool_name +
"\", \"var\": \"dedup_tier\", \"val\": \"" + low_tier_pool_name + "\"}",
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (r < 0) {
rados.shutdown();
return r;
r = rados.mon_command(
"{\"prefix\": \"osd pool set\", \"pool\": \"" + pool_name +
"\", \"var\": \"dedup_chunk_algorithm\", \"val\": \"" + chunk_algo + "\"}",
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (r < 0) {
rados.shutdown();
return r;
r = rados.mon_command(
"{\"prefix\": \"osd pool set\", \"pool\": \"" + pool_name +
"\", \"var\": \"dedup_cdc_chunk_size\", \"val\": \"" + chunk_size + "\"}",
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (r < 0) {
rados.shutdown();
return r;
int get_primary_osd(Rados& rados, const string& pool_name,
const string& oid, int *pprimary)
{
- bufferlist inbl;
string cmd = string("{\"prefix\": \"osd map\",\"pool\":\"")
+ pool_name
+ string("\",\"object\": \"")
+ oid
+ string("\",\"format\": \"json\"}");
bufferlist outbl;
- if (int r = rados.mon_command(cmd, inbl, &outbl, nullptr);
+ if (int r = rados.mon_command(std::move(cmd), {}, &outbl, nullptr);
r < 0) {
return r;
}
int fence_osd(Rados& rados, int osd)
{
- bufferlist inbl, outbl;
+ bufferlist outbl;
string cmd("{\"prefix\": \"injectargs\",\"injected_args\":["
"\"--ms-blackhole-osd\", "
"\"--ms-blackhole-mon\"]}");
- return rados.osd_command(osd, cmd, inbl, &outbl, NULL);
+ return rados.osd_command(osd, std::move(cmd), {}, &outbl, NULL);
}
int mark_down_osd(Rados& rados, int osd)
{
- bufferlist inbl, outbl;
+ bufferlist outbl;
string cmd("{\"prefix\": \"osd down\",\"ids\":[\"" +
stringify(osd) + "\"]}");
- return rados.mon_command(cmd, inbl, &outbl, NULL);
+ return rados.mon_command(std::move(cmd), {}, &outbl, NULL);
}
TEST(OSD, StaleRead) {
template <typename S>
int send_mon_command(S& s, librados::Rados& rados, const char* name,
- ceph::buffer::list& inbl, ceph::buffer::list* outbl,
+ ceph::buffer::list&& inbl, ceph::buffer::list* outbl,
Formatter* f) {
std::ostringstream oss;
encode_json(name, s, f);
f->flush(oss);
- int rc = rados.mon_command(oss.str(), inbl, outbl, nullptr);
+ int rc = rados.mon_command(oss.str(), std::move(inbl), outbl, nullptr);
return rc;
}
void ceph::io_sequence::tester::SelectErasureProfile::create(
const ceph::io_sequence::tester::Profile& profile) {
- bufferlist inbl, outbl;
+ bufferlist outbl;
auto formatter = std::make_unique<JSONFormatter>(false);
std::vector<std::string> profile_values = {
profile.name, profile_values, force};
int rc =
send_mon_command(ec_profile_set_request, rados, "OSDECProfileSetRequest",
- inbl, &outbl, formatter.get());
+ {}, &outbl, formatter.get());
ceph_assert(rc == 0);
}
ceph::io_sequence::tester::SelectErasureProfile::selectExistingProfile(
const std::string& profile_name) {
int rc;
- bufferlist inbl, outbl;
+ bufferlist outbl;
auto formatter = std::make_shared<JSONFormatter>(false);
ceph::messaging::osd::OSDECProfileGetRequest ec_profile_get_request{
profile_name};
rc = send_mon_command(ec_profile_get_request, rados, "OSDECProfileGetRequest",
- inbl, &outbl, formatter.get());
+ {}, &outbl, formatter.get());
ceph_assert(rc == 0);
JSONParser p;
if (!dry_run) {
if (isForced()) {
int rc;
- bufferlist inbl, outbl;
+ bufferlist outbl;
auto formatter = std::make_shared<JSONFormatter>(false);
ceph::messaging::osd::OSDPoolGetRequest osdPoolGetRequest{*force_value,
"all"};
- rc = send_mon_command(osdPoolGetRequest, rados, "OSDPoolGetRequest", inbl,
+ rc = send_mon_command(osdPoolGetRequest, rados, "OSDPoolGetRequest", {},
&outbl, formatter.get());
ceph_assert(rc == 0);
std::string ceph::io_sequence::tester::SelectErasurePool::create() {
int rc;
- bufferlist inbl, outbl;
+ bufferlist outbl;
auto formatter = std::make_shared<JSONFormatter>(false);
std::string pool_name;
ceph::messaging::osd::OSDECPoolCreateRequest pool_create_request{
pool_name, "erasure", 8, 8, profile->name};
rc = send_mon_command(pool_create_request, rados, "OSDECPoolCreateRequest",
- inbl, &outbl, formatter.get());
+ {}, &outbl, formatter.get());
ceph_assert(rc == 0);
return pool_name;
void ceph::io_sequence::tester::SelectErasurePool::setApplication(
const std::string& pool_name) {
- bufferlist inbl, outbl;
+ bufferlist outbl;
auto formatter = std::make_shared<JSONFormatter>(false);
ceph::messaging::osd::OSDEnableApplicationRequest
enableApplicationRequest{pool_name, "rados"};
int rc = send_mon_command(enableApplicationRequest, rados,
- "OSDEnableApplicationRequest", inbl, &outbl,
+ "OSDEnableApplicationRequest", {}, &outbl,
formatter.get());
ceph_assert(rc == 0);
bool allow_pool_ec_overwrites,
bool test_recovery) {
int rc;
- bufferlist inbl, outbl;
+ bufferlist outbl;
auto formatter = std::make_shared<JSONFormatter>(false);
if (!allow_pool_autoscaling) {
ceph::messaging::osd::OSDSetRequest no_autoscale_request{"noautoscale",
std::nullopt};
- rc = send_mon_command(no_autoscale_request, rados, "OSDSetRequest", inbl,
+ rc = send_mon_command(no_autoscale_request, rados, "OSDSetRequest", {},
&outbl, formatter.get());
ceph_assert(rc == 0);
}
if (!allow_pool_balancer) {
ceph::messaging::balancer::BalancerOffRequest balancer_off_request;
- rc = send_mon_command(balancer_off_request, rados, "BalancerOffRequest", inbl,
+ rc = send_mon_command(balancer_off_request, rados, "BalancerOffRequest", {},
&outbl, formatter.get());
ceph_assert(rc == 0);
ceph::messaging::balancer::BalancerStatusRequest balancer_status_request;
rc = send_mon_command(balancer_status_request, rados, "BalancerStatusRequest",
- inbl, &outbl, formatter.get());
+ {}, &outbl, formatter.get());
ceph_assert(rc == 0);
JSONParser p;
ceph::messaging::osd::OSDSetRequest no_deep_scrub_request{"nodeep-scrub",
std::nullopt};
rc = send_mon_command(no_deep_scrub_request, rados, "setNoDeepScrubRequest",
- inbl, &outbl, formatter.get());
+ {}, &outbl, formatter.get());
ceph_assert(rc == 0);
}
if (!allow_pool_scrubbing) {
ceph::messaging::osd::OSDSetRequest no_scrub_request{"noscrub",
std::nullopt};
- rc = send_mon_command(no_scrub_request, rados, "OSDSetRequest", inbl,
+ rc = send_mon_command(no_scrub_request, rados, "OSDSetRequest", {},
&outbl, formatter.get());
ceph_assert(rc == 0);
}
"true",
std::nullopt};
rc = send_mon_command(allow_ec_optimisations_request, rados,
- "OSDPoolSetRequest", inbl, &outbl, formatter.get());
+ "OSDPoolSetRequest", {}, &outbl, formatter.get());
ceph_assert(rc == 0);
}
"true",
std::nullopt};
rc = send_mon_command(allow_ec_optimisations_request, rados,
- "OSDPoolSetRequest", inbl, &outbl, formatter.get());
+ "OSDPoolSetRequest", {}, &outbl, formatter.get());
ceph_assert(rc == 0);
}
}
ceph::messaging::config::ConfigSetRequest bluestore_debug_request{
"global", "bluestore_debug_inject_read_err", "true", std::nullopt};
rc = send_mon_command(bluestore_debug_request, rados,
- "ConfigSetRequest", inbl, &outbl, formatter.get());
+ "ConfigSetRequest", {}, &outbl, formatter.get());
ceph_assert(rc == 0);
ceph::messaging::config::ConfigSetRequest max_markdown_request{
"global", "osd_max_markdown_count", "99999999", std::nullopt};
rc = send_mon_command(max_markdown_request, rados,
- "ConfigSetRequest", inbl, &outbl, formatter.get());
+ "ConfigSetRequest", {}, &outbl, formatter.get());
ceph_assert(rc == 0);
}
}
int threads = snt.select();
- bufferlist inbl, outbl;
+ bufferlist outbl;
auto formatter = std::make_unique<JSONFormatter>(false);
exerciser_model = std::make_unique<ceph::io_exerciser::RadosIo>(
"\\\"key\\\": \\\"" + peer.key + "\\\""
"}";
- bufferlist in_bl;
ASSERT_EQ(0, m_cluster->mon_command(
"{"
"\"prefix\": \"config-key set\","
"\"key\": \"" RBD_MIRROR_PEER_CONFIG_KEY_PREFIX + stringify(pool_id) +
"/" + peer.uuid + "\","
"\"val\": \"" + json + "\"" +
- "}", in_bl, nullptr, nullptr));
+ "}", {}, nullptr, nullptr));
}
void check_peers() {
snap = true;
}
- bufferlist inbl;
ret = rados.mon_command(
make_pool_str(pool_name, "fingerprint_algorithm", fp_algo),
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (ret < 0) {
std::cerr << " operate fail : " << cpp_strerror(ret) << std::endl;
return ret;
}
ret = rados.mon_command(
make_pool_str(pool_name, "dedup_tier", chunk_pool_name),
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (ret < 0) {
std::cerr << " operate fail : " << cpp_strerror(ret) << std::endl;
return ret;
}
ret = rados.mon_command(
make_pool_str(pool_name, "dedup_chunk_algorithm", "fastcdc"),
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (ret < 0) {
std::cerr << " operate fail : " << cpp_strerror(ret) << std::endl;
return ret;
}
ret = rados.mon_command(
make_pool_str(pool_name, "dedup_cdc_chunk_size", chunk_size),
- inbl, NULL, NULL);
+ {}, NULL, NULL);
if (ret < 0) {
std::cerr << " operate fail : " << cpp_strerror(ret) << std::endl;
return ret;
"\"key\": \"" + key + "\""
"}";
- bufferlist in_bl;
bufferlist out_bl;
- int r = m_local_cluster->mon_command(cmd, in_bl, &out_bl, nullptr);
+ int r = m_local_cluster->mon_command(std::move(cmd), {}, &out_bl, nullptr);
dout(5) << ": mon command r=" << r << dendl;
if (r < 0 && r != -ENOENT) {
return r;
int MirrorDaemonServiceInfo::get_mirror_service_dump() {
librados::Rados rados(m_io_ctx);
std::string cmd = R"({"prefix": "service dump", "format": "json"})";
- bufferlist in_bl;
bufferlist out_bl;
- int r = rados.mon_command(cmd, in_bl, &out_bl, nullptr);
+ int r = rados.mon_command(std::move(cmd), {}, &out_bl, nullptr);
if (r < 0) {
std::cerr << "rbd: failed to query services: " << cpp_strerror(r)
<< std::endl;
int MirrorDaemonServiceInfo::get_mirror_service_status() {
librados::Rados rados(m_io_ctx);
std::string cmd = R"({"prefix": "service status", "format": "json"})";
- bufferlist in_bl;
bufferlist out_bl;
- int r = rados.mon_command(cmd, in_bl, &out_bl, nullptr);
+ int r = rados.mon_command(std::move(cmd), {}, &out_bl, nullptr);
if (r < 0) {
std::cerr << "rbd: failed to query service status: " << cpp_strerror(r)
<< std::endl;
"prefix": ")" + cmd + R"(", )" + mgr_command_args_to_str(args) + R"(
})";
- bufferlist in_bl;
bufferlist out_bl;
std::string outs;
- int r = rados.mgr_command(command, in_bl, &out_bl, &outs);
+ int r = rados.mgr_command(std::move(command), {}, &out_bl, &outs);
if (r < 0) {
(*err_os) << "rbd: " << cmd << " failed: " << cpp_strerror(r);
if (!outs.empty()) {
"\"prefix\": \"config dump\", "
"\"format\": \"json\" "
"}";
- bufferlist in_bl;
bufferlist out_bl;
std::string ss;
- int r = rados.mon_command(cmd, in_bl, &out_bl, &ss);
+ int r = rados.mon_command(std::move(cmd), {}, &out_bl, &ss);
if (r < 0) {
std::cerr << "rbd: error reading config: " << ss << std::endl;
return r;
"\"name\": \"" + key + "\", "
"\"value\": \"" + stringify(json_stream_escaper(value)) + "\""
"}";
- bufferlist in_bl;
std::string ss;
- r = rados.mon_command(cmd, in_bl, nullptr, &ss);
+ r = rados.mon_command(std::move(cmd), {}, nullptr, &ss);
if (r < 0) {
std::cerr << "rbd: error setting " << key << ": " << ss << std::endl;
return r;
"\"who\": \"" + stringify(json_stream_escaper(config_entity)) + "\", "
"\"name\": \"" + key + "\""
"}";
- bufferlist in_bl;
std::string ss;
- r = rados.mon_command(cmd, in_bl, nullptr, &ss);
+ r = rados.mon_command(std::move(cmd), {}, nullptr, &ss);
if (r < 0) {
std::cerr << "rbd: error removing " << key << ": " << ss << std::endl;
return r;
"format": "json"
}")";
- bufferlist in_bl;
bufferlist out_bl;
std::string outs;
- int r = rados.mgr_command(cmd, in_bl, &out_bl, &outs);
+ int r = rados.mgr_command(std::move(cmd), {}, &out_bl, &outs);
if (r == -EOPNOTSUPP) {
err_os << "rbd: 'rbd_support' mgr module is not enabled."
<< std::endl << std::endl
"/" + peer->uuid + "\""
"}";
- bufferlist in_bl;
bufferlist out_bl;
- int r = m_cluster->mon_command(cmd, in_bl, &out_bl, nullptr);
+ int r = m_cluster->mon_command(std::move(cmd), {}, &out_bl, nullptr);
if (r == -ENOENT || out_bl.length() == 0) {
return 0;
} else if (r < 0) {