summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mgr/ActivePyModule.cc14
-rw-r--r--src/mgr/ActivePyModules.cc12
-rw-r--r--src/mgr/BaseMgrModule.cc14
-rw-r--r--src/mgr/BaseMgrStandbyModule.cc4
-rw-r--r--src/mgr/ClusterState.h4
-rw-r--r--src/mgr/DaemonServer.cc14
-rw-r--r--src/mgr/DaemonState.cc6
-rw-r--r--src/mgr/Gil.cc4
-rw-r--r--src/mgr/Mgr.cc24
-rw-r--r--src/mgr/MgrClient.cc20
-rw-r--r--src/mgr/MgrStandby.cc8
-rw-r--r--src/mgr/PyFormatter.cc4
-rw-r--r--src/mgr/PyFormatter.h4
-rw-r--r--src/mgr/PyModule.cc30
-rw-r--r--src/mgr/PyModule.h2
-rw-r--r--src/mgr/PyModuleRegistry.cc12
-rw-r--r--src/mgr/PyModuleRegistry.h4
-rw-r--r--src/mgr/PyModuleRunner.cc4
-rw-r--r--src/mgr/PyModuleRunner.h2
-rw-r--r--src/mgr/PyOSDMap.cc20
-rw-r--r--src/mgr/StandbyPyModules.cc6
21 files changed, 106 insertions, 106 deletions
diff --git a/src/mgr/ActivePyModule.cc b/src/mgr/ActivePyModule.cc
index 425b3f99c7f..d8a416bfde5 100644
--- a/src/mgr/ActivePyModule.cc
+++ b/src/mgr/ActivePyModule.cc
@@ -25,7 +25,7 @@
int ActivePyModule::load(ActivePyModules *py_modules)
{
- assert(py_modules);
+ ceph_assert(py_modules);
Gil gil(py_module->pMyThreadState, true);
// We tell the module how we name it, so that it can be consistent
@@ -51,7 +51,7 @@ int ActivePyModule::load(ActivePyModules *py_modules)
void ActivePyModule::notify(const std::string &notify_type, const std::string &notify_id)
{
- assert(pClassInstance != nullptr);
+ ceph_assert(pClassInstance != nullptr);
Gil gil(py_module->pMyThreadState, true);
@@ -74,7 +74,7 @@ void ActivePyModule::notify(const std::string &notify_type, const std::string &n
void ActivePyModule::notify_clog(const LogEntry &log_entry)
{
- assert(pClassInstance != nullptr);
+ ceph_assert(pClassInstance != nullptr);
Gil gil(py_module->pMyThreadState, true);
@@ -119,7 +119,7 @@ PyObject *ActivePyModule::dispatch_remote(
PyObject *kwargs,
std::string *err)
{
- assert(err != nullptr);
+ ceph_assert(err != nullptr);
// Rather than serializing arguments, pass the CPython objects.
// Works because we happen to know that the subinterpreter
@@ -134,7 +134,7 @@ PyObject *ActivePyModule::dispatch_remote(
auto boundMethod = PyObject_GetAttrString(pClassInstance, method.c_str());
// Caller should have done method_exists check first!
- assert(boundMethod != nullptr);
+ ceph_assert(boundMethod != nullptr);
dout(20) << "Calling " << py_module->get_name()
<< "." << method << "..." << dendl;
@@ -163,8 +163,8 @@ int ActivePyModule::handle_command(
std::stringstream *ds,
std::stringstream *ss)
{
- assert(ss != nullptr);
- assert(ds != nullptr);
+ ceph_assert(ss != nullptr);
+ ceph_assert(ds != nullptr);
if (pClassInstance == nullptr) {
// Not the friendliest error string, but we could only
diff --git a/src/mgr/ActivePyModules.cc b/src/mgr/ActivePyModules.cc
index 1695d4cc100..6bac2ec6e03 100644
--- a/src/mgr/ActivePyModules.cc
+++ b/src/mgr/ActivePyModules.cc
@@ -373,7 +373,7 @@ int ActivePyModules::start_one(PyModuleRef py_module)
{
Mutex::Locker l(lock);
- assert(modules.count(py_module->get_name()) == 0);
+ ceph_assert(modules.count(py_module->get_name()) == 0);
modules[py_module->get_name()].reset(new ActivePyModule(py_module, clog));
auto active_module = modules.at(py_module->get_name()).get();
@@ -485,7 +485,7 @@ PyObject *ActivePyModules::dispatch_remote(
std::string *err)
{
auto mod_iter = modules.find(other_module);
- assert(mod_iter != modules.end());
+ ceph_assert(mod_iter != modules.end());
return mod_iter->second->dispatch_remote(method, args, kwargs, err);
}
@@ -738,7 +738,7 @@ PyObject *construct_with_capsule(
derr << "Failed to import python module:" << dendl;
derr << handle_pyerror() << dendl;
}
- assert(module);
+ ceph_assert(module);
PyObject *wrapper_type = PyObject_GetAttrString(
module, (const char*)clsname.c_str());
@@ -746,11 +746,11 @@ PyObject *construct_with_capsule(
derr << "Failed to get python type:" << dendl;
derr << handle_pyerror() << dendl;
}
- assert(wrapper_type);
+ ceph_assert(wrapper_type);
// Construct a capsule containing an OSDMap.
auto wrapped_capsule = PyCapsule_New(wrapped, nullptr, nullptr);
- assert(wrapped_capsule);
+ ceph_assert(wrapped_capsule);
// Construct the python OSDMap
auto pArgs = PyTuple_Pack(1, wrapped_capsule);
@@ -759,7 +759,7 @@ PyObject *construct_with_capsule(
derr << "Failed to construct python OSDMap:" << dendl;
derr << handle_pyerror() << dendl;
}
- assert(wrapper_instance != nullptr);
+ ceph_assert(wrapper_instance != nullptr);
Py_DECREF(pArgs);
Py_DECREF(wrapped_capsule);
diff --git a/src/mgr/BaseMgrModule.cc b/src/mgr/BaseMgrModule.cc
index 0556a1c4511..c52bf165d86 100644
--- a/src/mgr/BaseMgrModule.cc
+++ b/src/mgr/BaseMgrModule.cc
@@ -58,7 +58,7 @@ public:
: py_modules(py_modules_), python_completion(ev),
tag(tag_), pThreadState(ts_)
{
- assert(python_completion != nullptr);
+ ceph_assert(python_completion != nullptr);
Py_INCREF(python_completion);
}
@@ -75,7 +75,7 @@ public:
void finish(int r) override
{
- assert(python_completion != nullptr);
+ ceph_assert(python_completion != nullptr);
dout(10) << "MonCommandCompletion::finish()" << dendl;
{
@@ -85,7 +85,7 @@ public:
Gil gil(pThreadState, true);
auto set_fn = PyObject_GetAttrString(python_completion, "complete");
- assert(set_fn != nullptr);
+ ceph_assert(set_fn != nullptr);
auto pyR = PyInt_FromLong(r);
auto pyOutBl = PyString_FromString(outbl.to_str().c_str());
@@ -131,7 +131,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
if (set_fn == nullptr) {
ceph_abort(); // TODO raise python exception instead
} else {
- assert(PyCallable_Check(set_fn));
+ ceph_assert(PyCallable_Check(set_fn));
}
Py_DECREF(set_fn);
@@ -472,7 +472,7 @@ ceph_log(BaseMgrModule *self, PyObject *args)
return nullptr;
}
- assert(self->this_module);
+ ceph_assert(self->this_module);
self->this_module->log(level, record);
@@ -696,10 +696,10 @@ BaseMgrModule_init(BaseMgrModule *self, PyObject *args, PyObject *kwds)
self->py_modules = static_cast<ActivePyModules*>(PyCapsule_GetPointer(
py_modules_capsule, nullptr));
- assert(self->py_modules);
+ ceph_assert(self->py_modules);
self->this_module = static_cast<ActivePyModule*>(PyCapsule_GetPointer(
this_module_capsule, nullptr));
- assert(self->this_module);
+ ceph_assert(self->this_module);
return 0;
}
diff --git a/src/mgr/BaseMgrStandbyModule.cc b/src/mgr/BaseMgrStandbyModule.cc
index d4ad2b74011..db980a2bcc5 100644
--- a/src/mgr/BaseMgrStandbyModule.cc
+++ b/src/mgr/BaseMgrStandbyModule.cc
@@ -49,7 +49,7 @@ BaseMgrStandbyModule_init(BaseMgrStandbyModule *self, PyObject *args, PyObject *
self->this_module = static_cast<StandbyPyModule*>(PyCapsule_GetPointer(
this_module_capsule, nullptr));
- assert(self->this_module);
+ ceph_assert(self->this_module);
return 0;
}
@@ -121,7 +121,7 @@ ceph_log(BaseMgrStandbyModule *self, PyObject *args)
return nullptr;
}
- assert(self->this_module);
+ ceph_assert(self->this_module);
self->this_module->log(level, record);
diff --git a/src/mgr/ClusterState.h b/src/mgr/ClusterState.h
index a270861e80b..d0ec594cc40 100644
--- a/src/mgr/ClusterState.h
+++ b/src/mgr/ClusterState.h
@@ -115,7 +115,7 @@ public:
void with_monmap(Args &&... args) const
{
Mutex::Locker l(lock);
- assert(monc != nullptr);
+ ceph_assert(monc != nullptr);
monc->with_monmap(std::forward<Args>(args)...);
}
@@ -123,7 +123,7 @@ public:
auto with_osdmap(Args &&... args) const ->
decltype(objecter->with_osdmap(std::forward<Args>(args)...))
{
- assert(objecter != nullptr);
+ ceph_assert(objecter != nullptr);
return objecter->with_osdmap(std::forward<Args>(args)...);
}
diff --git a/src/mgr/DaemonServer.cc b/src/mgr/DaemonServer.cc
index 702bf1629b5..47fde57a653 100644
--- a/src/mgr/DaemonServer.cc
+++ b/src/mgr/DaemonServer.cc
@@ -364,7 +364,7 @@ void DaemonServer::tick()
// fire after all modules have had a chance to set their health checks.
void DaemonServer::schedule_tick_locked(double delay_sec)
{
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
if (tick_event) {
timer.cancel_event(tick_event);
@@ -608,7 +608,7 @@ bool DaemonServer::handle_report(MMgrReport *m)
}
// Update the DaemonState
- assert(daemon != nullptr);
+ ceph_assert(daemon != nullptr);
{
Mutex::Locker l(daemon->lock);
auto &daemon_counters = daemon->perf_counters;
@@ -727,7 +727,7 @@ bool DaemonServer::handle_command(MCommand *m)
std::stringstream ss;
std::string prefix;
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
/**
* The working data for processing an MCommand. This lives in
@@ -914,7 +914,7 @@ bool DaemonServer::handle_command(MCommand *m)
for (auto& q : p.second.daemons) {
f->open_object_section(q.first.c_str());
DaemonKey key(p.first, q.first);
- assert(daemon_state.exists(key));
+ ceph_assert(daemon_state.exists(key));
auto daemon = daemon_state.get(key);
Mutex::Locker l(daemon->lock);
f->dump_stream("status_stamp") << daemon->service_status_stamp;
@@ -1215,7 +1215,7 @@ bool DaemonServer::handle_command(MCommand *m)
if (!pool_name.empty()) {
poolid = osdmap.lookup_pg_pool_name(pool_name);
if (poolid < 0) {
- assert(poolid == -ENOENT);
+ ceph_assert(poolid == -ENOENT);
ss << "unrecognized pool '" << pool_name << "'";
return -ENOENT;
}
@@ -1533,7 +1533,7 @@ bool DaemonServer::handle_command(MCommand *m)
}
break;
default:
- assert(0 == "actual_op value is not supported");
+ ceph_assert(0 == "actual_op value is not supported");
}
parsed_pgs.push_back(std::move(parsed_pg));
@@ -2317,7 +2317,7 @@ void DaemonServer::handle_conf_change(const ConfigProxy& conf,
void DaemonServer::_send_configure(ConnectionRef c)
{
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
auto configure = new MMgrConfigure();
configure->stats_period = g_conf().get_val<int64_t>("mgr_stats_period");
diff --git a/src/mgr/DaemonState.cc b/src/mgr/DaemonState.cc
index d8f36d0be01..1dd314da2d3 100644
--- a/src/mgr/DaemonState.cc
+++ b/src/mgr/DaemonState.cc
@@ -140,15 +140,15 @@ void DaemonStateIndex::insert(DaemonStatePtr dm)
void DaemonStateIndex::_erase(const DaemonKey& dmk)
{
- assert(lock.is_wlocked());
+ ceph_assert(lock.is_wlocked());
const auto to_erase = all.find(dmk);
- assert(to_erase != all.end());
+ ceph_assert(to_erase != all.end());
const auto dm = to_erase->second;
for (auto& i : dm->devices) {
auto d = _get_or_create_device(i.first);
- assert(d->daemons.count(dmk));
+ ceph_assert(d->daemons.count(dmk));
d->daemons.erase(dmk);
d->devnames.erase(make_pair(dm->hostname, i.second));
if (d->empty()) {
diff --git a/src/mgr/Gil.cc b/src/mgr/Gil.cc
index 9489a313108..d476c7177fb 100644
--- a/src/mgr/Gil.cc
+++ b/src/mgr/Gil.cc
@@ -27,7 +27,7 @@
SafeThreadState::SafeThreadState(PyThreadState *ts_)
: ts(ts_)
{
- assert(ts != nullptr);
+ ceph_assert(ts != nullptr);
thread = pthread_self();
}
@@ -60,7 +60,7 @@ Gil::Gil(SafeThreadState &ts, bool new_thread) : pThreadState(ts)
PyThreadState_Swap(pNewThreadState);
dout(20) << "Switched to new thread state " << pNewThreadState << dendl;
} else {
- assert(pthread_self() == pThreadState.thread);
+ ceph_assert(pthread_self() == pThreadState.thread);
}
}
diff --git a/src/mgr/Mgr.cc b/src/mgr/Mgr.cc
index ca784ebcab7..eb60ee24538 100644
--- a/src/mgr/Mgr.cc
+++ b/src/mgr/Mgr.cc
@@ -141,8 +141,8 @@ void MetadataUpdate::finish(int r)
void Mgr::background_init(Context *completion)
{
Mutex::Locker l(lock);
- assert(!initializing);
- assert(!initialized);
+ ceph_assert(!initializing);
+ ceph_assert(!initialized);
initializing = true;
finisher.start();
@@ -155,7 +155,7 @@ void Mgr::background_init(Context *completion)
std::map<std::string, std::string> Mgr::load_store()
{
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
dout(10) << "listing keys" << dendl;
JSONCommand cmd;
@@ -163,7 +163,7 @@ std::map<std::string, std::string> Mgr::load_store()
lock.Unlock();
cmd.wait();
lock.Lock();
- assert(cmd.r == 0);
+ ceph_assert(cmd.r == 0);
std::map<std::string, std::string> loaded;
@@ -216,8 +216,8 @@ std::map<std::string, std::string> Mgr::load_store()
void Mgr::init()
{
Mutex::Locker l(lock);
- assert(initializing);
- assert(!initialized);
+ ceph_assert(initializing);
+ ceph_assert(!initialized);
// Start communicating with daemons to learn statistics etc
int r = server.init(monc->get_global_id(), client_messenger->get_myaddrs());
@@ -295,7 +295,7 @@ void Mgr::init()
void Mgr::load_all_metadata()
{
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
JSONCommand mds_cmd;
mds_cmd.run(monc, "{\"prefix\": \"mds metadata\"}");
@@ -310,9 +310,9 @@ void Mgr::load_all_metadata()
mon_cmd.wait();
lock.Lock();
- assert(mds_cmd.r == 0);
- assert(mon_cmd.r == 0);
- assert(osd_cmd.r == 0);
+ ceph_assert(mds_cmd.r == 0);
+ ceph_assert(mon_cmd.r == 0);
+ ceph_assert(osd_cmd.r == 0);
for (auto &metadata_val : mds_cmd.json_result.get_array()) {
json_spirit::mObject daemon_meta = metadata_val.get_obj();
@@ -409,7 +409,7 @@ void Mgr::shutdown()
void Mgr::handle_osd_map()
{
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
std::set<std::string> names_exist;
@@ -539,7 +539,7 @@ bool Mgr::ms_dispatch(Message *m)
void Mgr::handle_fs_map(MFSMap* m)
{
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
std::set<std::string> names_exist;
diff --git a/src/mgr/MgrClient.cc b/src/mgr/MgrClient.cc
index ea6998167b7..0d6acf76bf0 100644
--- a/src/mgr/MgrClient.cc
+++ b/src/mgr/MgrClient.cc
@@ -34,14 +34,14 @@ MgrClient::MgrClient(CephContext *cct_, Messenger *msgr_)
: Dispatcher(cct_), cct(cct_), msgr(msgr_),
timer(cct_, lock)
{
- assert(cct != nullptr);
+ ceph_assert(cct != nullptr);
}
void MgrClient::init()
{
Mutex::Locker l(lock);
- assert(msgr != nullptr);
+ ceph_assert(msgr != nullptr);
timer.init();
}
@@ -107,7 +107,7 @@ bool MgrClient::ms_dispatch(Message *m)
void MgrClient::reconnect()
{
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
if (session) {
ldout(cct, 4) << "Terminating session with "
@@ -170,8 +170,8 @@ void MgrClient::reconnect()
// resend any pending commands
for (const auto &p : command_table.get_commands()) {
MCommand *m = p.second.get_message({});
- assert(session);
- assert(session->con);
+ ceph_assert(session);
+ ceph_assert(session->con);
session->con->send_message(m);
}
}
@@ -198,7 +198,7 @@ void MgrClient::_send_open()
bool MgrClient::handle_mgr_map(MMgrMap *m)
{
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
ldout(cct, 20) << *m << dendl;
@@ -249,8 +249,8 @@ void MgrClient::_send_stats()
void MgrClient::_send_report()
{
- assert(lock.is_locked_by_me());
- assert(session);
+ ceph_assert(lock.is_locked_by_me());
+ ceph_assert(session);
report_callback = nullptr;
auto report = new MMgrReport();
@@ -368,7 +368,7 @@ void MgrClient::_send_pgstats()
bool MgrClient::handle_mgr_configure(MMgrConfigure *m)
{
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
ldout(cct, 20) << *m << dendl;
@@ -435,7 +435,7 @@ int MgrClient::start_command(const vector<string>& cmd, const bufferlist& inbl,
bool MgrClient::handle_command_reply(MCommandReply *m)
{
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
ldout(cct, 20) << *m << dendl;
diff --git a/src/mgr/MgrStandby.cc b/src/mgr/MgrStandby.cc
index 9a914f773be..d90b799f577 100644
--- a/src/mgr/MgrStandby.cc
+++ b/src/mgr/MgrStandby.cc
@@ -179,7 +179,7 @@ int MgrStandby::init()
void MgrStandby::send_beacon()
{
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
dout(4) << state_str() << dendl;
std::list<PyModuleRef> modules = py_module_registry.get_modules();
@@ -253,7 +253,7 @@ void MgrStandby::tick()
void MgrStandby::handle_signal(int signum)
{
Mutex::Locker l(lock);
- assert(signum == SIGINT || signum == SIGTERM);
+ ceph_assert(signum == SIGINT || signum == SIGTERM);
derr << "*** Got signal " << sig_str(signum) << " ***" << dendl;
shutdown();
}
@@ -261,7 +261,7 @@ void MgrStandby::handle_signal(int signum)
void MgrStandby::shutdown()
{
// Expect already to be locked as we're called from signal handler
- assert(lock.is_locked_by_me());
+ ceph_assert(lock.is_locked_by_me());
dout(4) << "Shutting down" << dendl;
@@ -304,7 +304,7 @@ void MgrStandby::respawn()
/* Print CWD for the user's interest */
char buf[PATH_MAX];
char *cwd = getcwd(buf, sizeof(buf));
- assert(cwd);
+ ceph_assert(cwd);
dout(1) << " cwd " << cwd << dendl;
/* Fall back to a best-effort: just running in our CWD */
diff --git a/src/mgr/PyFormatter.cc b/src/mgr/PyFormatter.cc
index f2ef0de0b6f..4c71a2cb1de 100644
--- a/src/mgr/PyFormatter.cc
+++ b/src/mgr/PyFormatter.cc
@@ -39,14 +39,14 @@ void PyFormatter::open_object_section(const char *name)
void PyFormatter::dump_unsigned(const char *name, uint64_t u)
{
PyObject *p = PyLong_FromLongLong(u);
- assert(p);
+ ceph_assert(p);
dump_pyobject(name, p);
}
void PyFormatter::dump_int(const char *name, int64_t u)
{
PyObject *p = PyLong_FromLongLong(u);
- assert(p);
+ ceph_assert(p);
dump_pyobject(name, p);
}
diff --git a/src/mgr/PyFormatter.h b/src/mgr/PyFormatter.h
index 8b44916a047..9c7d54eebbc 100644
--- a/src/mgr/PyFormatter.h
+++ b/src/mgr/PyFormatter.h
@@ -76,8 +76,8 @@ public:
void open_object_section(const char *name) override;
void close_section() override
{
- assert(cursor != root);
- assert(!stack.empty());
+ ceph_assert(cursor != root);
+ ceph_assert(!stack.empty());
cursor = stack.top();
stack.pop();
}
diff --git a/src/mgr/PyModule.cc b/src/mgr/PyModule.cc
index b298b6949ab..a71d6c67db2 100644
--- a/src/mgr/PyModule.cc
+++ b/src/mgr/PyModule.cc
@@ -83,8 +83,8 @@ std::string peek_pyerror()
{
PyObject *ptype, *pvalue, *ptraceback;
PyErr_Fetch(&ptype, &pvalue, &ptraceback);
- assert(ptype);
- assert(pvalue);
+ ceph_assert(ptype);
+ ceph_assert(pvalue);
PyObject *pvalue_str = PyObject_Str(pvalue);
std::string exc_msg = PyString_AsString(pvalue_str);
Py_DECREF(pvalue_str);
@@ -189,12 +189,12 @@ std::string PyModule::get_site_packages()
// CPython doesn't auto-add site-packages dirs to sys.path for us,
// but it does provide a module that we can ask for them.
auto site_module = PyImport_ImportModule("site");
- assert(site_module);
+ ceph_assert(site_module);
auto site_packages_fn = PyObject_GetAttrString(site_module, "getsitepackages");
if (site_packages_fn != nullptr) {
auto site_packages_list = PyObject_CallObject(site_packages_fn, nullptr);
- assert(site_packages_list);
+ ceph_assert(site_packages_list);
auto n = PyList_Size(site_packages_list);
for (Py_ssize_t i = 0; i < n; ++i) {
@@ -212,7 +212,7 @@ std::string PyModule::get_site_packages()
// run inside virtualenvs :-/
auto site_packages_fn = PyObject_GetAttrString(site_module, "addsitepackages");
- assert(site_packages_fn);
+ ceph_assert(site_packages_fn);
auto known_paths = PySet_New(nullptr);
auto pArgs = PyTuple_Pack(1, known_paths);
@@ -222,9 +222,9 @@ std::string PyModule::get_site_packages()
Py_DECREF(site_packages_fn);
auto sys_module = PyImport_ImportModule("sys");
- assert(sys_module);
+ ceph_assert(sys_module);
auto sys_path = PyObject_GetAttrString(sys_module, "path");
- assert(sys_path);
+ ceph_assert(sys_path);
dout(1) << "sys.path:" << dendl;
auto n = PyList_Size(sys_path);
@@ -290,7 +290,7 @@ void PyModule::init_ceph_module()
#else
PyObject *ceph_module = Py_InitModule("ceph_module", module_methods);
#endif
- assert(ceph_module != nullptr);
+ ceph_assert(ceph_module != nullptr);
std::map<const char*, PyTypeObject*> classes{
{{"BaseMgrModule", &BaseMgrModuleType},
{"BaseMgrStandbyModule", &BaseMgrStandbyModuleType},
@@ -301,7 +301,7 @@ void PyModule::init_ceph_module()
for (auto [name, type] : classes) {
type->tp_new = PyType_GenericNew;
if (PyType_Ready(type) < 0) {
- assert(0);
+ ceph_assert(0);
}
Py_INCREF(type);
@@ -314,7 +314,7 @@ void PyModule::init_ceph_module()
int PyModule::load(PyThreadState *pMainThreadState)
{
- assert(pMainThreadState != nullptr);
+ ceph_assert(pMainThreadState != nullptr);
// Configure sub-interpreter
{
@@ -454,7 +454,7 @@ int PyModule::walk_dict_list(
const size_t list_size = PyList_Size(command_list);
for (size_t i = 0; i < list_size; ++i) {
PyObject *command = PyList_GetItem(command_list, i);
- assert(command != nullptr);
+ ceph_assert(command != nullptr);
if (!PyDict_Check(command)) {
derr << "Module " << get_name() << " has non-dict entry "
@@ -478,17 +478,17 @@ int PyModule::load_commands()
ModuleCommand command;
PyObject *pCmd = PyDict_GetItemString(pCommand, "cmd");
- assert(pCmd != nullptr);
+ ceph_assert(pCmd != nullptr);
command.cmdstring = PyString_AsString(pCmd);
dout(20) << "loaded command " << command.cmdstring << dendl;
PyObject *pDesc = PyDict_GetItemString(pCommand, "desc");
- assert(pDesc != nullptr);
+ ceph_assert(pDesc != nullptr);
command.helpstring = PyString_AsString(pDesc);
PyObject *pPerm = PyDict_GetItemString(pCommand, "perm");
- assert(pPerm != nullptr);
+ ceph_assert(pPerm != nullptr);
command.perm = PyString_AsString(pPerm);
command.polling = false;
@@ -516,7 +516,7 @@ int PyModule::load_options()
{
int r = walk_dict_list("OPTIONS", [this](PyObject *pOption) -> int {
PyObject *pName = PyDict_GetItemString(pOption, "name");
- assert(pName != nullptr);
+ ceph_assert(pName != nullptr);
ModuleOption option;
option.name = PyString_AsString(pName);
diff --git a/src/mgr/PyModule.h b/src/mgr/PyModule.h
index 353e222d8f6..3ffdeb8f13a 100644
--- a/src/mgr/PyModule.h
+++ b/src/mgr/PyModule.h
@@ -126,7 +126,7 @@ public:
void get_commands(std::vector<ModuleCommand> *out) const
{
Mutex::Locker l(lock);
- assert(out != nullptr);
+ ceph_assert(out != nullptr);
out->insert(out->end(), commands.begin(), commands.end());
}
diff --git a/src/mgr/PyModuleRegistry.cc b/src/mgr/PyModuleRegistry.cc
index c09e0eec518..dbf2e3e8c1d 100644
--- a/src/mgr/PyModuleRegistry.cc
+++ b/src/mgr/PyModuleRegistry.cc
@@ -62,7 +62,7 @@ void PyModuleRegistry::init()
// Drop the GIL and remember the main thread state (current
// thread state becomes NULL)
pMainThreadState = PyEval_SaveThread();
- assert(pMainThreadState != nullptr);
+ ceph_assert(pMainThreadState != nullptr);
std::list<std::string> failed_modules;
@@ -131,12 +131,12 @@ bool PyModuleRegistry::handle_mgr_map(const MgrMap &mgr_map_)
void PyModuleRegistry::standby_start(MonClient &mc)
{
Mutex::Locker l(lock);
- assert(active_modules == nullptr);
- assert(standby_modules == nullptr);
+ ceph_assert(active_modules == nullptr);
+ ceph_assert(standby_modules == nullptr);
// Must have seen a MgrMap by this point, in order to know
// which modules should be enabled
- assert(mgr_map.epoch > 0);
+ ceph_assert(mgr_map.epoch > 0);
dout(4) << "Starting modules in standby mode" << dendl;
@@ -185,11 +185,11 @@ void PyModuleRegistry::active_start(
dout(4) << "Starting modules in active mode" << dendl;
- assert(active_modules == nullptr);
+ ceph_assert(active_modules == nullptr);
// Must have seen a MgrMap by this point, in order to know
// which modules should be enabled
- assert(mgr_map.epoch > 0);
+ ceph_assert(mgr_map.epoch > 0);
if (standby_modules != nullptr) {
standby_modules->shutdown();
diff --git a/src/mgr/PyModuleRegistry.h b/src/mgr/PyModuleRegistry.h
index 568e7409960..089044433ed 100644
--- a/src/mgr/PyModuleRegistry.h
+++ b/src/mgr/PyModuleRegistry.h
@@ -110,7 +110,7 @@ public:
void with_active_modules(Callback&& cb, Args&&...args) const
{
Mutex::Locker l(lock);
- assert(active_modules != nullptr);
+ ceph_assert(active_modules != nullptr);
std::forward<Callback>(cb)(*active_modules, std::forward<Args>(args)...);
}
@@ -170,7 +170,7 @@ public:
std::map<std::string, std::string> get_services() const
{
- assert(active_modules);
+ ceph_assert(active_modules);
return active_modules->get_services();
}
// <<< (end of ActivePyModules cheeky call-throughs)
diff --git a/src/mgr/PyModuleRunner.cc b/src/mgr/PyModuleRunner.cc
index b0324d488d6..403c8a9f183 100644
--- a/src/mgr/PyModuleRunner.cc
+++ b/src/mgr/PyModuleRunner.cc
@@ -38,7 +38,7 @@ PyModuleRunner::~PyModuleRunner()
int PyModuleRunner::serve()
{
- assert(pClassInstance != nullptr);
+ ceph_assert(pClassInstance != nullptr);
// This method is called from a separate OS thread (i.e. a thread not
// created by Python), so tell Gil to wrap this in a new thread state.
@@ -75,7 +75,7 @@ int PyModuleRunner::serve()
void PyModuleRunner::shutdown()
{
- assert(pClassInstance != nullptr);
+ ceph_assert(pClassInstance != nullptr);
Gil gil(py_module->pMyThreadState, true);
diff --git a/src/mgr/PyModuleRunner.h b/src/mgr/PyModuleRunner.h
index c6bf18926fa..fb58bf0c232 100644
--- a/src/mgr/PyModuleRunner.h
+++ b/src/mgr/PyModuleRunner.h
@@ -70,7 +70,7 @@ public:
// required to be <16 chars
thread_name = py_module->get_name().substr(0, 15);
- assert(py_module != nullptr);
+ ceph_assert(py_module != nullptr);
}
~PyModuleRunner();
diff --git a/src/mgr/PyOSDMap.cc b/src/mgr/PyOSDMap.cc
index 3847176f0bd..3b050d29d47 100644
--- a/src/mgr/PyOSDMap.cc
+++ b/src/mgr/PyOSDMap.cc
@@ -192,14 +192,14 @@ BasePyOSDMap_init(BasePyOSDMap *self, PyObject *args, PyObject *kwds)
if (! PyArg_ParseTupleAndKeywords(args, kwds, "O",
const_cast<char**>(kwlist),
&osdmap_capsule)) {
- assert(0);
+ ceph_assert(0);
return -1;
}
- assert(PyObject_TypeCheck(osdmap_capsule, &PyCapsule_Type));
+ ceph_assert(PyObject_TypeCheck(osdmap_capsule, &PyCapsule_Type));
self->osdmap = (OSDMap*)PyCapsule_GetPointer(
osdmap_capsule, nullptr);
- assert(self->osdmap);
+ ceph_assert(self->osdmap);
return 0;
}
@@ -291,14 +291,14 @@ BasePyOSDMapIncremental_init(BasePyOSDMapIncremental *self,
if (! PyArg_ParseTupleAndKeywords(args, kwds, "O",
const_cast<char**>(kwlist),
&inc_capsule)) {
- assert(0);
+ ceph_assert(0);
return -1;
}
- assert(PyObject_TypeCheck(inc_capsule, &PyCapsule_Type));
+ ceph_assert(PyObject_TypeCheck(inc_capsule, &PyCapsule_Type));
self->inc = (OSDMap::Incremental*)PyCapsule_GetPointer(
inc_capsule, nullptr);
- assert(self->inc);
+ ceph_assert(self->inc);
return 0;
}
@@ -376,7 +376,7 @@ static PyObject *osdmap_inc_set_compat_weight_set_weights(
}
CrushWrapper crush;
- assert(self->inc->crush.length()); // see new_incremental
+ ceph_assert(self->inc->crush.length()); // see new_incremental
auto p = self->inc->crush.cbegin();
decode(crush, p);
crush.create_choose_args(CrushWrapper::DEFAULT_CHOOSE_ARGS, 1);
@@ -460,10 +460,10 @@ BasePyCRUSH_init(BasePyCRUSH *self,
if (! PyArg_ParseTupleAndKeywords(args, kwds, "O",
const_cast<char**>(kwlist),
&crush_capsule)) {
- assert(0);
+ ceph_assert(0);
return -1;
}
- assert(PyObject_TypeCheck(crush_capsule, &PyCapsule_Type));
+ ceph_assert(PyObject_TypeCheck(crush_capsule, &PyCapsule_Type));
auto ptr_ref = (std::shared_ptr<CrushWrapper>*)(
PyCapsule_GetPointer(crush_capsule, nullptr));
@@ -473,7 +473,7 @@ BasePyCRUSH_init(BasePyCRUSH *self,
// pointer construction now, and then we throw away that pointer to
// the shared pointer.
self->crush = *ptr_ref;
- assert(self->crush);
+ ceph_assert(self->crush);
return 0;
}
diff --git a/src/mgr/StandbyPyModules.cc b/src/mgr/StandbyPyModules.cc
index 60fe4a01747..0113ae1cf30 100644
--- a/src/mgr/StandbyPyModules.cc
+++ b/src/mgr/StandbyPyModules.cc
@@ -77,7 +77,7 @@ int StandbyPyModules::start_one(PyModuleRef py_module)
Mutex::Locker l(lock);
const std::string &module_name = py_module->get_name();
- assert(modules.count(module_name) == 0);
+ ceph_assert(modules.count(module_name) == 0);
modules[module_name].reset(new StandbyPyModule(
state,
@@ -104,9 +104,9 @@ int StandbyPyModule::load()
// We tell the module how we name it, so that it can be consistent
// with us in logging etc.
auto pThisPtr = PyCapsule_New(this, nullptr, nullptr);
- assert(pThisPtr != nullptr);
+ ceph_assert(pThisPtr != nullptr);
auto pModuleName = PyString_FromString(get_name().c_str());
- assert(pModuleName != nullptr);
+ ceph_assert(pModuleName != nullptr);
auto pArgs = PyTuple_Pack(2, pModuleName, pThisPtr);
Py_DECREF(pThisPtr);
Py_DECREF(pModuleName);