]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mgr/ActivePyModule.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / mgr / ActivePyModule.h
index 9dbf92e2c33ea4a13eff80409d101e92b82380b6..c3780269ee047bc6d1f0f0ff4f15a164dde82e4e 100644 (file)
 class ActivePyModule;
 class ActivePyModules;
 
-/**
- * A Ceph CLI command description provided from a Python module
- */
-class ModuleCommand {
-public:
-  std::string cmdstring;
-  std::string helpstring;
-  std::string perm;
-  ActivePyModule *handler;
-};
-
 class ActivePyModule : public PyModuleRunner
 {
 private:
   health_check_map_t health_checks;
 
-  std::vector<ModuleCommand> commands;
-
-  int load_commands();
-
   // Optional, URI exposed by plugins that implement serve()
   std::string uri;
 
 public:
-  ActivePyModule(const std::string &module_name_,
-      PyObject *pClass_,
-      const SafeThreadState &my_ts_,
+  ActivePyModule(const PyModuleRef &py_module_,
       LogChannelRef clog_)
-    : PyModuleRunner(module_name_, pClass_, my_ts_, clog_)
+    : PyModuleRunner(py_module_, clog_)
   {}
 
   int load(ActivePyModules *py_modules);
   void notify(const std::string &notify_type, const std::string &notify_id);
   void notify_clog(const LogEntry &le);
 
-  const std::vector<ModuleCommand> &get_commands() const
-  {
-    return commands;
-  }
+  bool method_exists(const std::string &method) const;
+
+  PyObject *dispatch_remote(
+      const std::string &method,
+      PyObject *args,
+      PyObject *kwargs,
+      std::string *err);
 
   int handle_command(
     const cmdmap_t &cmdmap,
+    const bufferlist &inbuf,
     std::stringstream *ds,
     std::stringstream *ss);
 
-  void set_health_checks(health_check_map_t&& c) {
+
+  bool set_health_checks(health_check_map_t&& c) {
+    // when health checks change a report is immediately sent to the monitors.
+    // currently modules have static health check details, but this equality
+    // test could be made smarter if too much noise shows up in the future.
+    bool changed = health_checks != c;
     health_checks = std::move(c);
+    return changed;
   }
   void get_health_checks(health_check_map_t *checks);
+  void config_notify();
 
   void set_uri(const std::string &str)
   {