]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: Support Docker Live Restore 61916/head
authorMichal Nasiadka <mnasiadka@gmail.com>
Wed, 11 Sep 2024 12:26:37 +0000 (14:26 +0200)
committerAdam King <adking@redhat.com>
Wed, 19 Feb 2025 20:41:08 +0000 (15:41 -0500)
Currently with Docker Live Restore [1] enabled and while restarting
Docker Engine - all Ceph container images will get restarted,
while the feature allows restarting docker.service without
containers downtime.

This is due to Requires=docker.service in systemd units templates,
which mandates that on docker.service restart - the ceph container
systemd units will be restarted as well.

Reworking Requires= to Wants= that is a weaker version of the former,
see [2].

Leaving After= entries, because they should allow systemd to correctly
order the startup (first docker, then ceph containers).

[1]: https://docs.docker.com/engine/daemon/live-restore/
[2]: https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#Wants=

Fixes: https://tracker.ceph.com/issues/68028
Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
(cherry picked from commit e0f77686523337f37e3ddbbe40eaa92c68947195)

Conflicts:
src/cephadm/cephadmlib/templates/ceph.service.j2
src/cephadm/cephadmlib/templates/init_ctr.service.j2
src/cephadm/cephadmlib/templates/sidecar.service.j2
src/cephadm/tests/test_unit_file.py

doc/cephadm/install.rst
src/cephadm/cephadm.py
src/cephadm/tests/test_cephadm.py

index c48327281c42aa25c64a934d74392fae6da530c5..cbbf534343a1866893321e4ac1d85132812d5e84 100644 (file)
@@ -24,6 +24,10 @@ Requirements
 Any modern Linux distribution should be sufficient.  Dependencies
 are installed automatically by the bootstrap process below.
 
+See `Docker Live Restore <https://docs.docker.com/engine/daemon/live-restore/>`_
+for an optional feature that allows restarting Docker Engine without restarting
+all running containers.
+
 See the section :ref:`Compatibility With Podman
 Versions<cephadm-compatibility-with-podman>` for a table of Ceph versions that
 are compatible with Podman. Not every version of Podman is compatible with
index 006e26d3acfd752cb0ecf20a73117a4b8321016c..673522eab7f252dc7b0a40762a76c14c31416760 100755 (executable)
@@ -4610,7 +4610,7 @@ Description=Ceph %i for {fsid}
 # configuration.
 After=network-online.target local-fs.target time-sync.target{docker_after}
 Wants=network-online.target local-fs.target time-sync.target
-{docker_requires}
+{docker_wants}
 
 PartOf=ceph-{fsid}.target
 Before=ceph-{fsid}.target
@@ -4637,7 +4637,7 @@ WantedBy=ceph-{fsid}.target
            extra_args=extra_args,
            # if docker, we depend on docker.service
            docker_after=' docker.service' if docker else '',
-           docker_requires='Requires=docker.service\n' if docker else '')
+           docker_wants='Wants=docker.service\n' if docker else '')
 
     return u
 
index f8dfdd28ec1563fa5973d5d0eed7658bc8b99e8f..824e2f61d7be3392b785a8015fbccc774b96701c 100644 (file)
@@ -41,10 +41,10 @@ class TestCephAdm(object):
         ctx = _cephadm.CephadmContext()
         ctx.container_engine = mock_docker()
         r = _cephadm.get_unit_file(ctx, '9b9d7609-f4d5-4aba-94c8-effa764d96c9')
-        assert 'Requires=docker.service' in r
+        assert 'Wants=docker.service' in r
         ctx.container_engine = mock_podman()
         r = _cephadm.get_unit_file(ctx, '9b9d7609-f4d5-4aba-94c8-effa764d96c9')
-        assert 'Requires=docker.service' not in r
+        assert 'Wants=docker.service' not in r
 
     @mock.patch('cephadm.logger')
     def test_attempt_bind(self, _logger):