Skip to content

Commit

Permalink
mgr/cephadm: Remove gateway.conf from iscsi pool when service is removed
Browse files Browse the repository at this point in the history
fixes: https://tracker.ceph.com/issues/48930

Signed-off-by: Juan Miguel Olmo Martínez <jolmomar@redhat.com>
  • Loading branch information
jmolmo committed Mar 22, 2021
1 parent e4cff91 commit 7e29d0a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/pybind/mgr/cephadm/services/iscsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from orchestrator import DaemonDescription, DaemonDescriptionStatus
from .cephadmservice import CephadmDaemonDeploySpec, CephService
from .. import utils
import rados

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -138,3 +139,14 @@ def ok_to_stop(self,
names = [f'{self.TYPE}.{d_id}' for d_id in daemon_ids]
warn_message = f'It is presumed safe to stop {names}'
return HandleCommandResult(0, warn_message, '')

def purge(self, service_name: str) -> None:
"""Removes the gateway.conf from the iscsi pool
"""
spec = cast(IscsiServiceSpec, self.mgr.spec_store[service_name].spec)
try:
with self.mgr.rados.open_ioctx(spec.pool) as ioctx:
ioctx.remove_object("gateway.conf")
logger.debug(f'<gateway.conf> removed from {spec.pool}')
except rados.ObjectNotFound:
pass

0 comments on commit 7e29d0a

Please sign in to comment.