]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm/iscsi: use `mon_command` in `post_remove` instead of `check_mon_command` 44830/head
authorMelissa Li <melissali@redhat.com>
Tue, 11 Jan 2022 23:03:23 +0000 (18:03 -0500)
committerAdam King <adking@redhat.com>
Fri, 28 Jan 2022 21:10:03 +0000 (16:10 -0500)
Use `mon_command` instead of `check_mon_command` in `post_remove` to avoid errors such as if iscsi service is removed before the iscsi gateway list is updated, cluster will enter error state and iscsi removal gets stuck.

Fixes: https://tracker.ceph.com/issues/53706
Signed-off-by: Melissa Li <melissali@redhat.com>
src/pybind/mgr/cephadm/services/iscsi.py

index fa54fa053a4f54b16f28f5cfb8d10731cb2e637a..d5896f075d497499b3b35eb2136920c2e78f13fc 100644 (file)
@@ -156,17 +156,17 @@ class IscsiService(CephService):
         """
         logger.debug(f'Post remove daemon {self.TYPE}.{daemon.daemon_id}')
 
-        if 'dashboard' in self.mgr.get('mgr_map')['modules']:
-            # remove config for dashboard iscsi gateways
-            ret, out, err = self.mgr.check_mon_command({
-                'prefix': 'dashboard iscsi-gateway-rm',
-                'name': daemon.hostname,
-            })
+        # remove config for dashboard iscsi gateways
+        ret, out, err = self.mgr.mon_command({
+            'prefix': 'dashboard iscsi-gateway-rm',
+            'name': daemon.hostname,
+        })
+        if not ret:
             logger.info(f'{daemon.hostname} removed from iscsi gateways dashboard config')
 
         # needed to know if we have ssl stuff for iscsi in ceph config
         iscsi_config_dict = {}
-        ret, iscsi_config, err = self.mgr.check_mon_command({
+        ret, iscsi_config, err = self.mgr.mon_command({
             'prefix': 'config-key dump',
             'key': 'iscsi',
         })
@@ -176,7 +176,7 @@ class IscsiService(CephService):
         # remove iscsi cert and key from ceph config
         for iscsi_key, value in iscsi_config_dict.items():
             if f'iscsi/client.{daemon.name()}/' in iscsi_key:
-                ret, out, err = self.mgr.check_mon_command({
+                ret, out, err = self.mgr.mon_command({
                     'prefix': 'config-key rm',
                     'key': iscsi_key,
                 })