mirror of
https://github.com/ceph/ceph
synced 2025-01-19 09:32:00 +00:00
mon/FSCommands: accept generic ostream rather than stringstream
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
parent
56b36e69fa
commit
31c8edd603
@ -27,12 +27,9 @@ using std::hex;
|
||||
using std::list;
|
||||
using std::map;
|
||||
using std::make_pair;
|
||||
using std::ostream;
|
||||
using std::ostringstream;
|
||||
using std::pair;
|
||||
using std::set;
|
||||
using std::string;
|
||||
using std::stringstream;
|
||||
using std::to_string;
|
||||
using std::vector;
|
||||
|
||||
@ -60,7 +57,7 @@ class FlagSetHandler : public FileSystemCommandHandler
|
||||
FSMap& fsmap,
|
||||
MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap,
|
||||
std::stringstream &ss) override
|
||||
std::ostream &ss) override
|
||||
{
|
||||
string flag_name;
|
||||
cmd_getval(cmdmap, "flag_name", flag_name);
|
||||
@ -101,7 +98,7 @@ class FailHandler : public FileSystemCommandHandler
|
||||
FSMap& fsmap,
|
||||
MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap,
|
||||
std::stringstream& ss) override
|
||||
std::ostream& ss) override
|
||||
{
|
||||
if (!mon->osdmon()->is_writeable()) {
|
||||
// not allowed to write yet, so retry when we can
|
||||
@ -158,7 +155,7 @@ class FsNewHandler : public FileSystemCommandHandler
|
||||
FSMap& fsmap,
|
||||
MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap,
|
||||
std::stringstream &ss) override
|
||||
std::ostream &ss) override
|
||||
{
|
||||
ceph_assert(m_paxos->is_plugged());
|
||||
|
||||
@ -324,7 +321,7 @@ public:
|
||||
FSMap& fsmap,
|
||||
MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap,
|
||||
std::stringstream &ss) override
|
||||
std::ostream &ss) override
|
||||
{
|
||||
std::string fs_name;
|
||||
if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) {
|
||||
@ -684,7 +681,7 @@ class RequiredClientFeaturesHandler : public FileSystemCommandHandler
|
||||
FSMap &fsmap,
|
||||
MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap,
|
||||
std::stringstream &ss) override
|
||||
std::ostream &ss) override
|
||||
{
|
||||
std::string fs_name;
|
||||
if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) {
|
||||
@ -776,7 +773,7 @@ class AddDataPoolHandler : public FileSystemCommandHandler
|
||||
FSMap& fsmap,
|
||||
MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap,
|
||||
std::stringstream &ss) override
|
||||
std::ostream &ss) override
|
||||
{
|
||||
ceph_assert(m_paxos->is_plugged());
|
||||
|
||||
@ -850,7 +847,7 @@ class SetDefaultHandler : public FileSystemCommandHandler
|
||||
FSMap& fsmap,
|
||||
MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap,
|
||||
std::stringstream &ss) override
|
||||
std::ostream &ss) override
|
||||
{
|
||||
std::string fs_name;
|
||||
cmd_getval(cmdmap, "fs_name", fs_name);
|
||||
@ -877,7 +874,7 @@ class RemoveFilesystemHandler : public FileSystemCommandHandler
|
||||
FSMap& fsmap,
|
||||
MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap,
|
||||
std::stringstream &ss) override
|
||||
std::ostream &ss) override
|
||||
{
|
||||
/* We may need to blocklist ranks. */
|
||||
if (!mon->osdmon()->is_writeable()) {
|
||||
@ -951,7 +948,7 @@ class ResetFilesystemHandler : public FileSystemCommandHandler
|
||||
FSMap& fsmap,
|
||||
MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap,
|
||||
std::stringstream &ss) override
|
||||
std::ostream &ss) override
|
||||
{
|
||||
string fs_name;
|
||||
cmd_getval(cmdmap, "fs_name", fs_name);
|
||||
@ -1001,7 +998,7 @@ class RenameFilesystemHandler : public FileSystemCommandHandler
|
||||
FSMap& fsmap,
|
||||
MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap,
|
||||
std::stringstream &ss) override
|
||||
std::ostream &ss) override
|
||||
{
|
||||
ceph_assert(m_paxos->is_plugged());
|
||||
|
||||
@ -1090,7 +1087,7 @@ class RemoveDataPoolHandler : public FileSystemCommandHandler
|
||||
FSMap& fsmap,
|
||||
MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap,
|
||||
std::stringstream &ss) override
|
||||
std::ostream &ss) override
|
||||
{
|
||||
string poolname;
|
||||
cmd_getval(cmdmap, "pool", poolname);
|
||||
@ -1165,7 +1162,7 @@ class AliasHandler : public T
|
||||
FSMap& fsmap,
|
||||
MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap,
|
||||
std::stringstream &ss) override
|
||||
std::ostream &ss) override
|
||||
{
|
||||
return T::handle(mon, fsmap, op, cmdmap, ss);
|
||||
}
|
||||
@ -1180,7 +1177,7 @@ public:
|
||||
|
||||
int handle(Monitor *mon,
|
||||
FSMap &fsmap, MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap, std::stringstream &ss) override {
|
||||
const cmdmap_t& cmdmap, std::ostream &ss) override {
|
||||
std::string fs_name;
|
||||
if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) {
|
||||
ss << "Missing filesystem name";
|
||||
@ -1215,7 +1212,7 @@ public:
|
||||
|
||||
int handle(Monitor *mon,
|
||||
FSMap &fsmap, MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap, std::stringstream &ss) override {
|
||||
const cmdmap_t& cmdmap, std::ostream &ss) override {
|
||||
std::string fs_name;
|
||||
if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) {
|
||||
ss << "Missing filesystem name";
|
||||
@ -1262,7 +1259,7 @@ public:
|
||||
}
|
||||
|
||||
bool peer_add(FSMap &fsmap, Filesystem::const_ref &&fs,
|
||||
const cmdmap_t &cmdmap, std::stringstream &ss) {
|
||||
const cmdmap_t &cmdmap, std::ostream &ss) {
|
||||
string peer_uuid;
|
||||
string remote_spec;
|
||||
string remote_fs_name;
|
||||
@ -1297,7 +1294,7 @@ public:
|
||||
|
||||
int handle(Monitor *mon,
|
||||
FSMap &fsmap, MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap, std::stringstream &ss) override {
|
||||
const cmdmap_t& cmdmap, std::ostream &ss) override {
|
||||
std::string fs_name;
|
||||
if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) {
|
||||
ss << "Missing filesystem name";
|
||||
@ -1332,7 +1329,7 @@ public:
|
||||
{}
|
||||
|
||||
bool peer_remove(FSMap &fsmap, Filesystem::const_ref &&fs,
|
||||
const cmdmap_t &cmdmap, std::stringstream &ss) {
|
||||
const cmdmap_t &cmdmap, std::ostream &ss) {
|
||||
string peer_uuid;
|
||||
cmd_getval(cmdmap, "uuid", peer_uuid);
|
||||
|
||||
@ -1350,7 +1347,7 @@ public:
|
||||
|
||||
int handle(Monitor *mon,
|
||||
FSMap &fsmap, MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap, std::stringstream &ss) override {
|
||||
const cmdmap_t& cmdmap, std::ostream &ss) override {
|
||||
std::string fs_name;
|
||||
if (!cmd_getval(cmdmap, "fs_name", fs_name) || fs_name.empty()) {
|
||||
ss << "Missing filesystem name";
|
||||
@ -1409,7 +1406,7 @@ int FileSystemCommandHandler::_check_pool(
|
||||
const int64_t pool_id,
|
||||
int type,
|
||||
bool force,
|
||||
std::stringstream *ss) const
|
||||
std::ostream *ss) const
|
||||
{
|
||||
ceph_assert(ss != NULL);
|
||||
|
||||
@ -1479,7 +1476,7 @@ int FileSystemCommandHandler::_check_pool(
|
||||
|
||||
int FileSystemCommandHandler::is_op_allowed(
|
||||
const MonOpRequestRef& op, const FSMap& fsmap, const cmdmap_t& cmdmap,
|
||||
std::stringstream &ss) const
|
||||
std::ostream &ss) const
|
||||
{
|
||||
string fs_name;
|
||||
cmd_getval(cmdmap, "fs_name", fs_name);
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "mds/FSMap.h"
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <ostream>
|
||||
|
||||
class FileSystemCommandHandler : protected CommandHandler
|
||||
{
|
||||
@ -38,7 +38,7 @@ protected:
|
||||
/**
|
||||
* Return 0 if the pool is suitable for use with CephFS, or
|
||||
* in case of errors return a negative error code, and populate
|
||||
* the passed stringstream with an explanation.
|
||||
* the passed ostream with an explanation.
|
||||
*
|
||||
* @param metadata whether the pool will be for metadata (stricter checks)
|
||||
*/
|
||||
@ -47,7 +47,7 @@ protected:
|
||||
const int64_t pool_id,
|
||||
int type,
|
||||
bool force,
|
||||
std::stringstream *ss) const;
|
||||
std::ostream *ss) const;
|
||||
|
||||
virtual std::string const &get_prefix() const {return prefix;}
|
||||
|
||||
@ -60,10 +60,10 @@ public:
|
||||
{}
|
||||
|
||||
int is_op_allowed(const MonOpRequestRef& op, const FSMap& fsmap,
|
||||
const cmdmap_t& cmdmap, std::stringstream &ss) const;
|
||||
const cmdmap_t& cmdmap, std::ostream &ss) const;
|
||||
|
||||
int can_handle(std::string const &prefix_, MonOpRequestRef& op, FSMap& fsmap,
|
||||
const cmdmap_t& cmdmap, std::stringstream &ss) const
|
||||
const cmdmap_t& cmdmap, std::ostream &ss) const
|
||||
{
|
||||
if (get_prefix() != prefix_) {
|
||||
return 0;
|
||||
@ -87,7 +87,7 @@ public:
|
||||
FSMap &fsmap,
|
||||
MonOpRequestRef op,
|
||||
const cmdmap_t& cmdmap,
|
||||
std::stringstream &ss) = 0;
|
||||
std::ostream &ss) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user