]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: nfs migration: avoid port conflicts 44631/head
authorSebastian Wagner <sewagner@redhat.com>
Thu, 6 Jan 2022 11:35:38 +0000 (12:35 +0100)
committerSebastian Wagner <sewagner@redhat.com>
Tue, 18 Jan 2022 11:02:31 +0000 (12:02 +0100)
The nfs upgrade renames the nfs spec from `nfs.ganesha-{service_id}`
to `nfs.{service_id}`. Previously we used the orphan-daemon check
to remove the old `nfs.ganesha-{service_id}` daemons. This does not work
as sometimes serve() tries to deploy the new daemons before cleaning up the
old daemons. This results in a port conflict breaking the upgrade.

Fixes: https://tracker.ceph.com/issues/53424
Signed-off-by: Sebastian Wagner <sewagner@redhat.com>
(cherry picked from commit d2cbf9153f02b67d18e168adaeb65940859cc75a)

src/pybind/mgr/cephadm/migrations.py

index 941ede3666de3ece6c64a3cd0e70ed9ed4b61d46..04faba760d071475fe77cab2ecd04bc4be0cdfd9 100644 (file)
@@ -229,6 +229,12 @@ class Migrations:
             self.mgr.spec_store.rm(f'nfs.ganesha-{service_id}')
             spec.service_id = service_id
             self.mgr.spec_store.save(spec, True)
+
+            # We have to remove the old daemons here as well, otherwise we'll end up with a port conflict.
+            daemons = [d.name()
+                       for d in self.mgr.cache.get_daemons_by_service(f'nfs.ganesha-{service_id}')]
+            self.mgr.log.info(f'Removing old nfs.ganesha-{service_id} daemons {daemons}')
+            self.mgr.remove_daemons(daemons)
         else:
             # redeploy all ganesha daemons to ensures that the daemon
             # cephx are correct AND container configs are set up properly