Skip to content

Commit e0f7768

Browse files
committed
cephadm: Support Docker Live Restore
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 <[email protected]>
1 parent fc70b44 commit e0f7768

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

doc/cephadm/install.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ Requirements
2424
Any modern Linux distribution should be sufficient. Dependencies
2525
are installed automatically by the bootstrap process below.
2626

27+
See `Docker Live Restore <https://docs.docker.com/engine/daemon/live-restore/>`_
28+
for an optional feature that allows restarting Docker Engine without restarting
29+
all running containers.
30+
2731
See the section :ref:`Compatibility With Podman
2832
Versions<cephadm-compatibility-with-podman>` for a table of Ceph versions that
2933
are compatible with Podman. Not every version of Podman is compatible with

src/cephadm/cephadmlib/templates/ceph.service.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Description=Ceph %i for {{fsid}}
99
After=network-online.target local-fs.target time-sync.target{% if has_docker_engine %} docker.service{% endif %}
1010
Wants=network-online.target local-fs.target time-sync.target
1111
{%- if has_docker_engine %}
12-
Requires=docker.service
12+
Wants=docker.service
1313
{%- endif %}
1414

1515
PartOf=ceph-{{fsid}}.target

src/cephadm/cephadmlib/templates/init_ctr.service.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ After=network-online.target local-fs.target time-sync.target
55
Wants=network-online.target local-fs.target time-sync.target
66
{%- if has_docker_engine %}
77
After=docker.service
8-
Requires=docker.service
8+
Wants=docker.service
99
{%- endif %}
1010
Before=ceph-{{ identity.fsid }}@%i.service
1111

src/cephadm/cephadmlib/templates/sidecar.service.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ After=network-online.target local-fs.target time-sync.target
55
Wants=network-online.target local-fs.target time-sync.target
66
{%- if has_docker_engine %}
77
After=docker.service
8-
Requires=docker.service
8+
Wants=docker.service
99
{%- endif %}
1010
After={{ primary.service_name }}
1111

src/cephadm/tests/test_unit_file.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ def _get_unit_file(ctx, fsid):
2727
return str(systemd_unit._get_unit_file(ctx, fsid))
2828

2929

30-
def test_docker_engine_requires_docker():
30+
def test_docker_engine_wants_docker():
3131
ctx = context.CephadmContext()
3232
ctx.container_engine = mock_docker()
3333
r = _get_unit_file(ctx, '9b9d7609-f4d5-4aba-94c8-effa764d96c9')
34-
assert 'Requires=docker.service' in r
34+
assert 'Wants=docker.service' in r
3535

3636

3737
def test_podman_engine_does_not_req_docker():
@@ -80,7 +80,7 @@ def test_new_docker():
8080
'# configuration.',
8181
'After=network-online.target local-fs.target time-sync.target docker.service',
8282
'Wants=network-online.target local-fs.target time-sync.target',
83-
'Requires=docker.service',
83+
'Wants=docker.service',
8484
'PartOf=ceph-9b9d7609-f4d5-4aba-94c8-effa764d96c9.target',
8585
'Before=ceph-9b9d7609-f4d5-4aba-94c8-effa764d96c9.target',
8686
'[Service]',

0 commit comments

Comments
 (0)