Skip to content

Commit d8dae24

Browse files
committed
mgr/cephadm: set service name for DaemonDescription object used during daemon removal
What this is specifically fixing is that the nvmeof post_remove function needs the service spec of the daemon's service to get the pool and group tied to the nvmeof daemon. We have been using the DaemonDescription "service_name" property to get the service name in order to get the spec. This works in a regular deployment. However, it is possible to make a placement like placement: hosts: - vm-00=nvmeof.a - vm-01=nvmeof.b and one of the nvmeof CI tests was doing so, which is why we saw this. That will cause the nvmeof daemon names to be nvmeof.nvmeof.a and nvmeof.nvmeof.b and not include the service name at all. In this case, the service_name property on the DaemonDescription class will end up getting service names nvmeof.nvmeof.a and nvmeof.nvmeof.b respectively from the nvmeof daemons, which will cause us to fail to find the spec in post_remove. This change makes it so we manually set the service name for the DaemonDescription object that gets passed to post_remove based on the service name of the daemon object we get from the host cache, which will still have the correct service name even if the daemon has a custom name. Then the nvmeof post_remove function will get the correct service name and be able to find the spec. Additionally, we now take are technically taking the daemon type and id from the DaemonDescription in our HostCache as well, but this is mostly just for consistency and should have no real impact. Fixes: https://tracker.ceph.com/issues/68962 Signed-off-by: Adam King <adking@redhat.com>
1 parent 71d50d8 commit d8dae24

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/pybind/mgr/cephadm/serve.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,18 +1551,21 @@ def _remove_daemon(self, name: str, host: str, no_post_remove: bool = False) ->
15511551
"""
15521552
Remove a daemon
15531553
"""
1554-
(daemon_type, daemon_id) = name.split('.', 1)
1554+
dd = self.mgr.cache.get_daemon(name)
1555+
daemon_type = dd.daemon_type
1556+
daemon_id = dd.daemon_id
1557+
assert (daemon_type is not None and daemon_id is not None)
15551558
daemon = orchestrator.DaemonDescription(
15561559
daemon_type=daemon_type,
15571560
daemon_id=daemon_id,
1561+
service_name=dd.service_name(),
15581562
hostname=host)
15591563

15601564
with set_exception_subject('service', daemon.service_id(), overwrite=True):
15611565

15621566
self.mgr.cephadm_services[daemon_type_to_service(daemon_type)].pre_remove(daemon)
15631567
# NOTE: we are passing the 'force' flag here, which means
15641568
# we can delete a mon instances data.
1565-
dd = self.mgr.cache.get_daemon(daemon.daemon_name)
15661569
if dd.ports:
15671570
args = ['--name', name, '--force', '--tcp-ports', ' '.join(map(str, dd.ports))]
15681571
else:

0 commit comments

Comments
 (0)