static void usage()
{
- cout << "usage: ceph-mgr -i <ID> [flags]\n"
- << std::endl;
+ std::cout << "usage: ceph-mgr -i <ID> [flags]\n"
+ << std::endl;
generic_server_usage();
}
{
ceph_pthread_setname(pthread_self(), "ceph-mgr");
- vector<const char*> args;
+ std::vector<const char*> args;
argv_to_vec(argc, argv, args);
if (args.empty()) {
- cerr << argv[0] << ": -h or --help for usage" << std::endl;
+ std::cerr << argv[0] << ": -h or --help for usage" << std::endl;
exit(1);
}
if (ceph_argparse_need_usage(args)) {
exit(0);
}
- map<string,string> defaults = {
+ std::map<std::string,std::string> defaults = {
{ "keyring", "$mgr_data/keyring" }
};
auto cct = global_init(&defaults, args, CEPH_ENTITY_TYPE_MGR,
#undef dout_prefix
#define dout_prefix *_dout << "mgr " << __func__ << " "
+using std::string;
+using namespace std::literals;
+
int ActivePyModule::load(ActivePyModules *py_modules)
{
ceph_assert(py_modules);
#undef dout_prefix
#define dout_prefix *_dout << "mgr " << __func__ << " "
+using std::pair;
+using std::string;
+using namespace std::literals;
+
ActivePyModules::ActivePyModules(
PyModuleConfig &module_config_,
std::map<std::string, std::string> store_data,
#define PLACEHOLDER ""
+using std::list;
+using std::string;
typedef struct {
PyObject_HEAD
#define dout_context g_ceph_context
#define dout_subsys ceph_subsys_mgr
+using std::string;
+
typedef struct {
PyObject_HEAD
StandbyPyModule *this_module;
#undef dout_prefix
#define dout_prefix *_dout << "mgr " << __func__ << " "
+using std::ostream;
+using std::set;
+using std::string;
+using std::stringstream;
+
ClusterState::ClusterState(
MonClient *monc_,
Objecter *objecter_,
MgrMap mgr_map;
- map<int64_t,unsigned> existing_pools; ///< pools that exist, and pg_num, as of PGMap epoch
+ std::map<int64_t,unsigned> existing_pools; ///< pools that exist, and pg_num, as of PGMap epoch
PGMap pg_map;
PGMap::Incremental pending_inc;
bool asok_command(std::string_view admin_command,
const cmdmap_t& cmdmap,
Formatter *f,
- ostream& ss);
+ std::ostream& ss);
};
#endif
namespace {
+using std::unique_ptr;
+using std::vector;
+using std::ostringstream;
+
class SlowOps final : public DaemonHealthMetricCollector {
bool _is_relevant(daemon_metric type) const override {
return type == daemon_metric::SLOW_OPS;
#define dout_subsys ceph_subsys_mgr
#undef dout_prefix
#define dout_prefix *_dout << "mgr.server " << __func__ << " "
+
using namespace TOPNSPC::common;
+
+using std::list;
+using std::ostringstream;
+using std::string;
+using std::stringstream;
+using std::vector;
+using std::unique_ptr;
+
namespace {
template <typename Map>
bool map_compare(Map const &lhs, Map const &rhs) {
auto dump_cmd = [&cmdnum, &f, m](const MonCommand &mc){
ostringstream secname;
- secname << "cmd" << setfill('0') << std::setw(3) << cmdnum;
+ secname << "cmd" << std::setfill('0') << std::setw(3) << cmdnum;
dump_cmddesc_to_json(&f, m->get_connection()->get_features(),
secname.str(), mc.cmdstring, mc.helpstring,
mc.module, mc.req_perms, 0);
std::set<ConnectionRef> daemon_connections;
/// connections for osds
- ceph::unordered_map<int,set<ConnectionRef>> osd_cons;
+ ceph::unordered_map<int,std::set<ConnectionRef>> osd_cons;
ServiceMap pending_service_map; // uncommitted
ceph::mutex lock = ceph::make_mutex("DaemonServer");
static void _generate_command_map(cmdmap_t& cmdmap,
- map<string,string> ¶m_str_map);
- static const MonCommand *_get_mgrcommand(const string &cmd_prefix,
+ std::map<std::string,std::string> ¶m_str_map);
+ static const MonCommand *_get_mgrcommand(const std::string &cmd_prefix,
const std::vector<MonCommand> &commands);
bool _allowed_command(
- MgrSession *s, const string &service, const string &module,
- const string &prefix, const cmdmap_t& cmdmap,
- const map<string,string>& param_str_map,
+ MgrSession *s, const std::string &service, const std::string &module,
+ const std::string &prefix, const cmdmap_t& cmdmap,
+ const std::map<std::string,std::string>& param_str_map,
const MonCommand *this_cmd);
private:
void _prune_pending_service_map();
void _check_offlines_pgs(
- const set<int>& osds,
+ const std::set<int>& osds,
const OSDMap& osdmap,
const PGMap& pgmap,
offline_pg_report *report);
#undef dout_prefix
#define dout_prefix *_dout << "mgr " << __func__ << " "
+using std::list;
+using std::make_pair;
+using std::map;
+using std::ostream;
+using std::ostringstream;
+using std::string;
+using std::stringstream;
+using std::unique_ptr;
+
void DeviceState::set_metadata(map<string,string>&& m)
{
metadata = std::move(m);
metadata = m;
auto p = m.find("device_ids");
if (p != m.end()) {
- map<std::string,std::string> devs, paths; // devname -> id or path
+ std::map<std::string,std::string> devs, paths; // devname -> id or path
get_str_map(p->second, &devs, ",; ");
auto q = m.find("device_paths");
if (q != m.end()) {
std::set<std::tuple<std::string,std::string,std::string>> attachments;
std::set<DaemonKey> daemons;
- std::map<string,string> metadata; ///< persistent metadata
+ std::map<std::string,std::string> metadata; ///< persistent metadata
- pair<utime_t,utime_t> life_expectancy; ///< when device failure is expected
+ std::pair<utime_t,utime_t> life_expectancy; ///< when device failure is expected
utime_t life_expectancy_stamp; ///< when life expectency was recorded
float wear_level = -1; ///< SSD wear level (negative if unknown)
- void set_metadata(map<string,string>&& m);
+ void set_metadata(std::map<std::string,std::string>&& m);
void set_life_expectancy(utime_t from, utime_t to, utime_t now);
void rm_life_expectancy();
void set_wear_level(float wear);
- string get_life_expectancy_str(utime_t now) const;
+ std::string get_life_expectancy_str(utime_t now) const;
/// true of we can be safely forgotten/removed from memory
bool empty() const {
}
void dump(Formatter *f) const;
- void print(ostream& out) const;
+ void print(std::ostream& out) const;
private:
FRIEND_MAKE_REF(DeviceState);
}
void update_metadata(DaemonStatePtr state,
- const map<string,string>& meta) {
+ const std::map<std::string,std::string>& meta) {
// remove and re-insert in case the device metadata changed
std::unique_lock l{lock};
_rm(state->key);
#undef dout_prefix
#define dout_prefix *_dout << "mgr " << __func__ << " "
+using namespace std::literals;
+
+using std::map;
+using std::ostringstream;
+using std::string;
Mgr::Mgr(MonClient *monc_, const MgrMap& mgrmap,
PyModuleRegistry *py_module_registry_,
#undef dout_prefix
#define dout_prefix *_dout << "mgr " << __func__ << " "
+using std::map;
+using std::string;
+using std::vector;
MgrStandby::MgrStandby(int argc, const char **argv) :
Dispatcher(g_ceph_context),
int init();
void shutdown();
void respawn();
- int main(vector<const char *> args);
+ int main(std::vector<const char *> args);
void tick();
};
#include "include/ceph_assert.h" // boost clobbers this
+using std::string;
+using std::wstring;
+
// decode a Python exception into a string
std::string handle_pyerror(
bool crash_dump,
#define dout_context g_ceph_context
#define dout_subsys ceph_subsys_mgr
+using std::map;
+using std::set;
+using std::string;
+using std::vector;
typedef struct {
PyObject_HEAD
p != d.second.metadata.end()) {
type = p->second;
}
- for (auto k : {make_pair("zone", "zone_id"),
- make_pair("host", "hostname")}) {
+ for (auto k : {std::make_pair("zone", "zone_id"),
+ std::make_pair("host", "hostname")}) {
auto p = d.second.metadata.find(k.second);
if (p != d.second.metadata.end()) {
groupings[k.first].insert(p->second);