]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/mgr: OPTIONS -> MODULE_OPTIONS
authorSage Weil <sage@redhat.com>
Mon, 3 Dec 2018 20:22:18 +0000 (14:22 -0600)
committerSage Weil <sage@redhat.com>
Mon, 10 Dec 2018 18:11:44 +0000 (12:11 -0600)
We want to distinguish between module options (mgr/$module/name)
and compiled-in ceph options (common/options.cc).

Signed-off-by: Sage Weil <sage@redhat.com>
19 files changed:
src/mgr/PyModule.cc
src/mgr/PyModule.h
src/pybind/mgr/balancer/module.py
src/pybind/mgr/dashboard/module.py
src/pybind/mgr/deepsea/module.py
src/pybind/mgr/devicehealth/module.py
src/pybind/mgr/diskprediction_cloud/module.py
src/pybind/mgr/diskprediction_local/module.py
src/pybind/mgr/influx/module.py
src/pybind/mgr/localpool/module.py
src/pybind/mgr/mgr_module.py
src/pybind/mgr/orchestrator_cli/module.py
src/pybind/mgr/prometheus/module.py
src/pybind/mgr/restful/module.py
src/pybind/mgr/rook/module.py
src/pybind/mgr/selftest/module.py
src/pybind/mgr/telegraf/module.py
src/pybind/mgr/telemetry/module.py
src/pybind/mgr/zabbix/module.py

index 9838bbff7c219d84d08d65f5a5291196f22201c3..e2b855a2920094529594502d5d2dd6ada01baec3 100644 (file)
@@ -372,9 +372,9 @@ int PyModule::load(PyThreadState *pMainThreadState)
 
     r = load_options();
     if (r != 0) {
-      derr << "Missing or invalid OPTIONS attribute in module '"
+      derr << "Missing or invalid MODULE_OPTIONS attribute in module '"
           << module_name << "'" << dendl;
-      error_string = "Missing or invalid OPTIONS attribute";
+      error_string = "Missing or invalid MODULE_OPTIONS attribute";
       return r;
     }
 
@@ -514,13 +514,13 @@ int PyModule::load_commands()
 
 int PyModule::load_options()
 {
-  int r = walk_dict_list("OPTIONS", [this](PyObject *pOption) -> int {
+  int r = walk_dict_list("MODULE_OPTIONS", [this](PyObject *pOption) -> int {
     PyObject *pName = PyDict_GetItemString(pOption, "name");
     ceph_assert(pName != nullptr);
 
     ModuleOption option;
     option.name = PyString_AsString(pName);
-    dout(20) << "loaded option " << option.name << dendl;
+    dout(20) << "loaded module option " << option.name << dendl;
 
     options[option.name] = std::move(option);
 
index 84d3a6f62f0ffe5f17eff7e31a3888e70b075fed..fe4ba9fc37fda0a8294dc6f8dba051d831f64b64 100644 (file)
@@ -81,7 +81,7 @@ private:
   // Populated if loaded, can_run or failed indicates a problem
   std::string error_string;
 
-  // Helper for loading OPTIONS and COMMANDS members
+  // Helper for loading MODULE_OPTIONS and COMMANDS members
   int walk_dict_list(
       const std::string &attr_name,
       std::function<int(PyObject*)> fn);
index 3d51aad7b954f475784d7043bfaa4cac88bca761..77c1459755f4694f8c755a7926d3b053500129e9 100644 (file)
@@ -201,7 +201,7 @@ class Eval:
         return r
 
 class Module(MgrModule):
-    OPTIONS = [
+    MODULE_OPTIONS = [
             {'name': 'active'},
             {'name': 'begin_time'},
             {'name': 'crush_compat_max_iterations'},
index 9558be86273a7f5dc8e3189e1eceee1f5606fcc2..c7c9892e8ccf4ccc3bc8c5784023d453304488f2 100644 (file)
@@ -239,7 +239,7 @@ class Module(MgrModule, CherryPyConfig):
     COMMANDS.extend(ACCESS_CONTROL_COMMANDS)
     COMMANDS.extend(SSO_COMMANDS)
 
-    OPTIONS = [
+    MODULE_OPTIONS = [
         {'name': 'server_addr'},
         {'name': 'server_port'},
         {'name': 'jwt_token_ttl'},
@@ -250,7 +250,7 @@ class Module(MgrModule, CherryPyConfig):
         {'name': 'crt_file'},
         {'name': 'ssl'}
     ]
-    OPTIONS.extend(options_schema_list())
+    MODULE_OPTIONS.extend(options_schema_list())
 
     def __init__(self, *args, **kwargs):
         super(Module, self).__init__(*args, **kwargs)
index ededbd8885b7dfc001affef7bb01e3afffbce8b4..d94ab86dfe56574a8f7f0c10ffac553f47eccaa4 100644 (file)
@@ -44,7 +44,7 @@ class DeepSeaReadCompletion(orchestrator.ReadCompletion):
 
 
 class DeepSeaOrchestrator(MgrModule, orchestrator.Orchestrator):
-    OPTIONS = [
+    MODULE_OPTIONS = [
         {
             'name': 'salt_api_url',
             'default': None
@@ -81,7 +81,7 @@ class DeepSeaOrchestrator(MgrModule, orchestrator.Orchestrator):
 
     @property
     def config_keys(self):
-        return dict((o['name'], o.get('default', None)) for o in self.OPTIONS)
+        return dict((o['name'], o.get('default', None)) for o in self.MODULE_OPTIONS)
 
 
     def get_config(self, key, default=None):
index 3513cd5269b4ca5784f75e1d8d32d756ad676168..215811a21f6fca86cd14264e1e1884487557d2a5 100644 (file)
@@ -24,7 +24,7 @@ HEALTH_MESSAGES = {
 
 
 class Module(MgrModule):
-    OPTIONS = [
+    MODULE_OPTIONS = [
         {
             'name': 'enable_monitoring',
             'default': str(False),
@@ -113,7 +113,7 @@ class Module(MgrModule):
         super(Module, self).__init__(*args, **kwargs)
 
         # options
-        for opt in self.OPTIONS:
+        for opt in self.MODULE_OPTIONS:
             setattr(self, opt['name'], opt['default'])
 
         # other
@@ -189,7 +189,7 @@ class Module(MgrModule):
             assert before != after
 
     def config_notify(self):
-        for opt in self.OPTIONS:
+        for opt in self.MODULE_OPTIONS:
             setattr(self,
                     opt['name'],
                     self.get_config(opt['name']) or opt['default'])
index 885243ab75a7dfaa524141ce74a2d6a881d54587..583f99b5fe27f661d63ee5e956a50c4b4265f466 100644 (file)
@@ -36,7 +36,7 @@ def decode_string(value):
 
 class Module(MgrModule):
 
-    OPTIONS = [
+    MODULE_OPTIONS = [
         {
             'name': 'diskprediction_server',
             'default': ''
@@ -128,7 +128,7 @@ class Module(MgrModule):
         self._run = True
 
     def config_notify(self):
-        for opt in self.OPTIONS:
+        for opt in self.MODULE_OPTIONS:
             setattr(self,
                     opt['name'],
                     self.get_config(opt['name']) or opt['default'])
@@ -140,7 +140,7 @@ class Module(MgrModule):
 
     @property
     def config_keys(self):
-        return dict((o['name'], o.get('default', None)) for o in self.OPTIONS)
+        return dict((o['name'], o.get('default', None)) for o in self.MODULE_OPTIONS)
 
     def set_config_option(self, option, value):
         if option not in self.config_keys.keys():
@@ -232,7 +232,7 @@ class Module(MgrModule):
         return 0, msg, ''
 
     def refresh_config(self):
-        for opt in self.OPTIONS:
+        for opt in self.MODULE_OPTIONS:
             setattr(self,
                     opt['name'],
                     self.get_config(opt['name']) or opt['default'])
index 98a014209f01e03653fec4b21273526acd556d80..17e3fc2cff3632fd8a10eb482c5a21036137d322 100644 (file)
@@ -16,7 +16,7 @@ TIME_WEEK = TIME_DAYS * 7
 
 
 class Module(MgrModule):
-    OPTIONS = [
+    MODULE_OPTIONS = [
         {
             'name': 'sleep_interval',
             'default': str(600),
@@ -32,14 +32,14 @@ class Module(MgrModule):
     def __init__(self, *args, **kwargs):
         super(Module, self).__init__(*args, **kwargs)
         # options
-        for opt in self.OPTIONS:
+        for opt in self.MODULE_OPTIONS:
             setattr(self, opt['name'], opt['default'])
         # other
         self._run = True
         self._event = Event()
 
     def config_notify(self):
-        for opt in self.OPTIONS:
+        for opt in self.MODULE_OPTIONS:
             setattr(self,
                     opt['name'],
                     self.get_config(opt['name']) or opt['default'])
@@ -48,7 +48,7 @@ class Module(MgrModule):
             self._event.set()
 
     def refresh_config(self):
-        for opt in self.OPTIONS:
+        for opt in self.MODULE_OPTIONS:
             setattr(self,
                     opt['name'],
                     self.get_config(opt['name']) or opt['default'])
index 6937cc9fc8c1f3db99c029fcdc45d2f4550e70bf..a9db1a263d428716afed57972c7f0358e7021361 100644 (file)
@@ -20,7 +20,7 @@ except ImportError:
 
 
 class Module(MgrModule):
-    OPTIONS = [
+    MODULE_OPTIONS = [
             {
                 'name': 'hostname',
                 'default': None
@@ -66,7 +66,7 @@ class Module(MgrModule):
     @property
     def config_keys(self):
         return dict((o['name'], o.get('default', None))
-                for o in self.OPTIONS)
+                for o in self.MODULE_OPTIONS)
 
     COMMANDS = [
         {
index dd37e0adadb16ba5559348085373aece5de96570..ca556d68ac9ffd95194ea3e8a90a4f68c3b7cf61 100644 (file)
@@ -4,7 +4,7 @@ import threading
 
 class Module(MgrModule):
 
-    OPTIONS = [
+    MODULE_OPTIONS = [
             {'name': 'failure_domain'},
             {'name': 'min_size'},
             {'name': 'num_rep'},
index 040833a6064f0fe304ab4b70a78a3b94b734f8f4..221a02d234607be1fc500277c4f0b538a31cb119 100644 (file)
@@ -269,7 +269,7 @@ class MgrStandbyModule(ceph_module.BaseMgrStandbyModule):
 
 class MgrModule(ceph_module.BaseMgrModule):
     COMMANDS = []
-    OPTIONS = []
+    MODULE_OPTIONS = []
 
     # Priority definitions for perf counters
     PRIO_CRITICAL = 10
@@ -684,8 +684,8 @@ class MgrModule(ceph_module.BaseMgrModule):
         access config options that they didn't declare
         in their schema.
         """
-        if key not in [o['name'] for o in self.OPTIONS]:
-            raise RuntimeError("Config option '{0}' is not in {1}.OPTIONS".\
+        if key not in [o['name'] for o in self.MODULE_OPTIONS]:
+            raise RuntimeError("Config option '{0}' is not in {1}.MODULE_OPTIONS".\
                     format(key, self.__class__.__name__))
 
     def _get_config(self, key, default):
index 756f932636612285e6c64cece9f1a7e8c1c2d3c0..a4e3675d7e721ab7d58ca8422420cfbb6910550d 100644 (file)
@@ -10,7 +10,7 @@ class NoOrchestrator(Exception):
 
 
 class OrchestratorCli(MgrModule):
-    OPTIONS = [
+    MODULE_OPTIONS = [
         {'name': 'orchestrator'}
     ]
     COMMANDS = [
index 4806202ac302baf189fe16582eeb9ccf53c5fbf9..44ad503d2d1b47de4993d11a8d2c03abbef7f34a 100644 (file)
@@ -153,7 +153,7 @@ class Module(MgrModule):
         },
     ]
 
-    OPTIONS = [
+    MODULE_OPTIONS = [
             {'name': 'server_addr'},
             {'name': 'server_port'},
             {'name': 'scrape_interval'},
index 009425d22192245ae55c1493e41d125d63b93822..163f428ec1624e54b5dad2788d685f02bdba0ba0 100644 (file)
@@ -199,7 +199,7 @@ class CommandsRequest(object):
 
 
 class Module(MgrModule):
-    OPTIONS = [
+    MODULE_OPTIONS = [
         {'name': 'server_addr'},
         {'name': 'server_port'},
         {'name': 'key_file'},
index d01576d21d14ca952273168c44cc2fdef9681760..0ed0f0936c540f6eb4a2b503601ec21563e4747a 100644 (file)
@@ -128,7 +128,7 @@ def deferred_read(f):
 
 
 class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
-    OPTIONS = [
+    MODULE_OPTIONS = [
         # TODO: configure k8s API addr instead of assuming local
     ]
 
index 3e86774aa293528d8532eddb093dc06f5fda1065..9635abeac58ababd88e70bb4a78e18ed56d4ce09 100644 (file)
@@ -28,7 +28,7 @@ class Module(MgrModule):
 
     # The test code in qa/ relies on these options existing -- they
     # are of course not really used for anything in the module
-    OPTIONS = [
+    MODULE_OPTIONS = [
             {'name': 'testkey'},
             {'name': 'testlkey'},
             {'name': 'testnewline'}
index 4d0346ab68a61797d931013a5821ff9cbf60403f..c0fb653c5887261a1afb19e4dce6974c63d6549e 100644 (file)
@@ -36,7 +36,7 @@ class Module(MgrModule):
         },
     ]
 
-    OPTIONS = [
+    MODULE_OPTIONS = [
         {
             'name': 'address',
             'default': 'unixgram:///tmp/telegraf.sock',
@@ -51,7 +51,7 @@ class Module(MgrModule):
 
     @property
     def config_keys(self):
-        return dict((o['name'], o.get('default', None)) for o in self.OPTIONS)
+        return dict((o['name'], o.get('default', None)) for o in self.MODULE_OPTIONS)
 
     def __init__(self, *args, **kwargs):
         super(Module, self).__init__(*args, **kwargs)
index f331e1825326b1725ac25d96d18ff627d5004b0e..f648ae821bd9ca74763f8df17e2da3f4c75f9ec8 100644 (file)
@@ -31,7 +31,7 @@ class Module(MgrModule):
             "distro"
     ]
 
-    OPTIONS = [
+    MODULE_OPTIONS = [
         {
             'name': 'url',
             'default': 'https://telemetry.ceph.com/report'
@@ -92,7 +92,7 @@ class Module(MgrModule):
 
     @property
     def config_keys(self):
-        return dict((o['name'], o.get('default', None)) for o in self.OPTIONS)
+        return dict((o['name'], o.get('default', None)) for o in self.MODULE_OPTIONS)
 
     def __init__(self, *args, **kwargs):
         super(Module, self).__init__(*args, **kwargs)
index 27f7a5c3296b8dd15345921124850a9ef59ad3e9..e9aa2cc12063d71ba07dfc50f4cde57c3b77b7a1 100644 (file)
@@ -55,9 +55,9 @@ class Module(MgrModule):
     @property
     def config_keys(self):
         return dict((o['name'], o.get('default', None))
-                for o in self.OPTIONS)
+                for o in self.MODULE_OPTIONS)
 
-    OPTIONS = [
+    MODULE_OPTIONS = [
             {
                 'name': 'zabbix_sender',
                 'default': '/usr/bin/zabbix_sender'