]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: fix typing errors related to storage_class_name and device ls
authorJoseph Sawaya <jsawaya@redhat.com>
Wed, 30 Jun 2021 20:51:21 +0000 (16:51 -0400)
committerJoseph Sawaya <jsawaya@redhat.com>
Tue, 13 Jul 2021 17:55:05 +0000 (13:55 -0400)
This commit fixes a couple of typing issues related to the updating of
the storage_class_name module option and the get_discovered_devices
function called when a user does ceph orch device ls.

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

index 8778086d2eced2f686f800cb56c13c5aa39c631a..f947bec9b0cbfb0b747cdaf14620df76b56c65a5 100644 (file)
@@ -127,8 +127,8 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
                     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
+        assert isinstance(self.storage_class_name, str)
+        self.rook_cluster.storage_class_name = self.storage_class_name
 
     def shutdown(self) -> None:
         self._shutdown.set()
index 86dae8aabfd1b75f4400bcecff9bfca6351acadf..fd6c7dd5ac0038d6aead2957668b04847c3a550a 100644 (file)
@@ -280,7 +280,6 @@ class RookCluster(object):
                 log.exception("Failed to fetch device metadata")
                 raise
 
-        nodename_to_devices = {}
         lso_devices = {}
         for i in lso_discovery_results:
             drives = i['status']['discoveredDevices']
@@ -288,7 +287,7 @@ class RookCluster(object):
                 lso_devices[drive['deviceID'].split('/')[-1]] = drive
         pvs_in_sc = [i for i in self.pvs.items if i.spec.storage_class_name == self.storage_class_name]
 
-        def convert_size(size_str: str):
+        def convert_size(size_str: str) -> int:
             units = ("", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei")
             unit = size_str[-2:]
             try:
@@ -300,6 +299,7 @@ class RookCluster(object):
             size = coeff * (2 ** (10 * factor))
             return size
 
+        nodename_to_devices: Dict[str, Any] = {}
         for i in pvs_in_sc:
             if (not i.metadata.annotations) or ('storage.openshift.com/device-id' not in i.metadata.annotations) or (i.metadata.annotations['storage.openshift.com/device-id'] not in lso_devices):
                 size = convert_size(i.spec.capacity['storage'])