From: Melissa Li Date: Tue, 11 Jan 2022 23:03:23 +0000 (-0500) Subject: mgr/cephadm/iscsi: use `mon_command` in `post_remove` instead of `check_mon_command` X-Git-Tag: v18.0.0~1497^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ddd6c398f47343e07b01c6cd72eec647e68db806;p=ceph.git mgr/cephadm/iscsi: use `mon_command` in `post_remove` instead of `check_mon_command` 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 --- diff --git a/src/pybind/mgr/cephadm/services/iscsi.py b/src/pybind/mgr/cephadm/services/iscsi.py index fa54fa053a4f..d5896f075d49 100644 --- a/src/pybind/mgr/cephadm/services/iscsi.py +++ b/src/pybind/mgr/cephadm/services/iscsi.py @@ -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, })