]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: add mgr/rook/storage_class_name to ceph config
authorJoseph Sawaya <jsawaya@redhat.com>
Wed, 30 Jun 2021 20:06:08 +0000 (16:06 -0400)
committerJoseph Sawaya <jsawaya@redhat.com>
Tue, 13 Jul 2021 17:55:05 +0000 (13:55 -0400)
This commit adds a storage_class_name Option for the Rook Module
so the user can specify a storage class that the orchestrator
will look at to gather inventory.

Signed-off-by: Joseph Sawaya <jsawaya@redhat.com>
src/pybind/mgr/rook/module.py

index 4b4e00a56443340dec591845ca2181d92b87200a..f78141c650b427ddf6f7e1b4709c153f67472f5b 100644 (file)
@@ -73,6 +73,12 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
 
     MODULE_OPTIONS: List[Option] = [
         # TODO: configure k8s API addr instead of assuming local
+        Option(
+            'storage_class_name',
+            type='str',
+            default='local-sc',
+            desc='storage class name for LSO-discovered PVs',
+        ),
     ]
 
     @staticmethod
@@ -105,8 +111,23 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
         self._k8s_CustomObjects_api: Optional[client.CustomObjectsApi] = None
         self._rook_cluster: Optional[RookCluster] = None
         self._rook_env = RookEnv()
+        self.storage_class_name = self.get_module_option('storage_class_name')
 
         self._shutdown = threading.Event()
+    def config_notify(self) -> None:
+        """
+        This method is called whenever one of our config options is changed.
+
+        TODO: this method should be moved into mgr_module.py
+        """
+        for opt in self.MODULE_OPTIONS:
+            setattr(self,
+                    opt['name'],  # type: ignore
+                    self.get_module_option(opt['name']))  # type: ignore
+            self.log.debug(' mgr option %s = %s',
+                           opt['name'], getattr(self, opt['name']))  # type: ignore
+
+        self._rook_cluster.storage_class_name = self.storage_class_name
 
     def shutdown(self) -> None:
         self._shutdown.set()