From 5ba7824c55e4a5d6732208859293ac3f47bb54a2 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Thu, 12 Nov 2020 11:34:41 +0100 Subject: [PATCH] container: force rm --storage on ExecStartPre This is a workaround to avoid error like following: ``` Error: error creating container storage: the container name "ceph-mgr-magna022" is already in use by "4a5f674e113f837a0cc561dea5d2cd55d16ca159a647b7794ab06c4c276ef701" ``` that doesn't seem to be 100% reproducible but it shows up after a reboot. The only workaround we came up with at the moment is to run `podman rm --storage ` before starting it. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1887716 Signed-off-by: Guillaume Abrioux --- roles/ceph-crash/templates/ceph-crash.service.j2 | 1 + roles/ceph-grafana/templates/grafana-server.service.j2 | 1 + roles/ceph-iscsi-gw/templates/rbd-target-api.service.j2 | 1 + roles/ceph-iscsi-gw/templates/rbd-target-gw.service.j2 | 1 + roles/ceph-iscsi-gw/templates/tcmu-runner.service.j2 | 1 + roles/ceph-mds/templates/ceph-mds.service.j2 | 1 + roles/ceph-mgr/templates/ceph-mgr.service.j2 | 1 + roles/ceph-mon/templates/ceph-mon.service.j2 | 1 + roles/ceph-nfs/templates/ceph-nfs.service.j2 | 1 + roles/ceph-node-exporter/templates/node_exporter.service.j2 | 1 + roles/ceph-osd/templates/ceph-osd.service.j2 | 1 + roles/ceph-prometheus/templates/alertmanager.service.j2 | 1 + roles/ceph-prometheus/templates/prometheus.service.j2 | 1 + roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 | 1 + roles/ceph-rgw/templates/ceph-radosgw.service.j2 | 1 + 15 files changed, 15 insertions(+) diff --git a/roles/ceph-crash/templates/ceph-crash.service.j2 b/roles/ceph-crash/templates/ceph-crash.service.j2 index 8987301c2..d970bda62 100644 --- a/roles/ceph-crash/templates/ceph-crash.service.j2 +++ b/roles/ceph-crash/templates/ceph-crash.service.j2 @@ -10,6 +10,7 @@ After=network.target [Service] {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage ceph-crash-%i {% endif %} ExecStartPre=-/usr/bin/{{ container_binary }} rm -f ceph-crash-%i ExecStart=/usr/bin/{{ container_binary }} run --rm --name ceph-crash-%i \ diff --git a/roles/ceph-grafana/templates/grafana-server.service.j2 b/roles/ceph-grafana/templates/grafana-server.service.j2 index 4fa8cb765..1346014c9 100644 --- a/roles/ceph-grafana/templates/grafana-server.service.j2 +++ b/roles/ceph-grafana/templates/grafana-server.service.j2 @@ -13,6 +13,7 @@ After=network.target EnvironmentFile=-/etc/environment {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage grafana-server {% else %} ExecStartPre=-/usr/bin/{{ container_binary }} stop grafana-server {% endif %} diff --git a/roles/ceph-iscsi-gw/templates/rbd-target-api.service.j2 b/roles/ceph-iscsi-gw/templates/rbd-target-api.service.j2 index 0ad0138af..02f279a7b 100644 --- a/roles/ceph-iscsi-gw/templates/rbd-target-api.service.j2 +++ b/roles/ceph-iscsi-gw/templates/rbd-target-api.service.j2 @@ -11,6 +11,7 @@ After=network.target EnvironmentFile=-/etc/environment {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage rbd-target-api {% else %} ExecStartPre=-/usr/bin/{{ container_binary }} stop rbd-target-api {% endif %} diff --git a/roles/ceph-iscsi-gw/templates/rbd-target-gw.service.j2 b/roles/ceph-iscsi-gw/templates/rbd-target-gw.service.j2 index 9ce35f4b8..3e0e076f6 100644 --- a/roles/ceph-iscsi-gw/templates/rbd-target-gw.service.j2 +++ b/roles/ceph-iscsi-gw/templates/rbd-target-gw.service.j2 @@ -11,6 +11,7 @@ After=network.target EnvironmentFile=-/etc/environment {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage rbd-target-gw {% else %} ExecStartPre=-/usr/bin/{{ container_binary }} stop rbd-target-gw {% endif %} diff --git a/roles/ceph-iscsi-gw/templates/tcmu-runner.service.j2 b/roles/ceph-iscsi-gw/templates/tcmu-runner.service.j2 index 9f1b8d390..2c13993d5 100644 --- a/roles/ceph-iscsi-gw/templates/tcmu-runner.service.j2 +++ b/roles/ceph-iscsi-gw/templates/tcmu-runner.service.j2 @@ -11,6 +11,7 @@ After=network.target EnvironmentFile=-/etc/environment {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage tcmu-runner {% else %} ExecStartPre=-/usr/bin/{{ container_binary }} stop tcmu-runner {% endif %} diff --git a/roles/ceph-mds/templates/ceph-mds.service.j2 b/roles/ceph-mds/templates/ceph-mds.service.j2 index c41012c98..0bd208c4d 100644 --- a/roles/ceph-mds/templates/ceph-mds.service.j2 +++ b/roles/ceph-mds/templates/ceph-mds.service.j2 @@ -12,6 +12,7 @@ After=network.target EnvironmentFile=-/etc/environment {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage ceph-mds-{{ ansible_hostname }} {% else %} ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-mds-{{ ansible_hostname }} {% endif %} diff --git a/roles/ceph-mgr/templates/ceph-mgr.service.j2 b/roles/ceph-mgr/templates/ceph-mgr.service.j2 index f58921bd9..136d63f77 100644 --- a/roles/ceph-mgr/templates/ceph-mgr.service.j2 +++ b/roles/ceph-mgr/templates/ceph-mgr.service.j2 @@ -11,6 +11,7 @@ After=network.target EnvironmentFile=-/etc/environment {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage ceph-mgr-{{ ansible_hostname }} {% else %} ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-mgr-{{ ansible_hostname }} {% endif %} diff --git a/roles/ceph-mon/templates/ceph-mon.service.j2 b/roles/ceph-mon/templates/ceph-mon.service.j2 index 19386a362..99a98f1e1 100644 --- a/roles/ceph-mon/templates/ceph-mon.service.j2 +++ b/roles/ceph-mon/templates/ceph-mon.service.j2 @@ -11,6 +11,7 @@ After=network.target EnvironmentFile=-/etc/environment {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage ceph-mon-%i {% endif %} ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-mon-%i ExecStartPre=/bin/sh -c '"$(command -v mkdir)" -p /etc/ceph /var/lib/ceph/mon' diff --git a/roles/ceph-nfs/templates/ceph-nfs.service.j2 b/roles/ceph-nfs/templates/ceph-nfs.service.j2 index 6e27e2751..bae6d38cd 100644 --- a/roles/ceph-nfs/templates/ceph-nfs.service.j2 +++ b/roles/ceph-nfs/templates/ceph-nfs.service.j2 @@ -12,6 +12,7 @@ After=network.target EnvironmentFile=-/etc/environment {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage ceph-nfs-%i {% endif %} ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-nfs-%i ExecStartPre={{ '/bin/mkdir' if ansible_os_family == 'Debian' else '/usr/bin/mkdir' }} -p /etc/ceph /etc/ganesha /var/lib/nfs/ganesha /var/log/ganesha diff --git a/roles/ceph-node-exporter/templates/node_exporter.service.j2 b/roles/ceph-node-exporter/templates/node_exporter.service.j2 index 2fcef2534..070bda94a 100644 --- a/roles/ceph-node-exporter/templates/node_exporter.service.j2 +++ b/roles/ceph-node-exporter/templates/node_exporter.service.j2 @@ -13,6 +13,7 @@ After=network.target EnvironmentFile=-/etc/environment {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage node-exporter {% endif %} ExecStartPre=-/usr/bin/{{ container_binary }} rm -f node-exporter ExecStart=/usr/bin/{{ container_binary }} run --rm --name=node-exporter \ diff --git a/roles/ceph-osd/templates/ceph-osd.service.j2 b/roles/ceph-osd/templates/ceph-osd.service.j2 index 4a7a61dc9..10d9904a1 100644 --- a/roles/ceph-osd/templates/ceph-osd.service.j2 +++ b/roles/ceph-osd/templates/ceph-osd.service.j2 @@ -13,6 +13,7 @@ After=network.target EnvironmentFile=-/etc/environment {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage ceph-osd-%i {% else %} ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-osd-%i {% endif %} diff --git a/roles/ceph-prometheus/templates/alertmanager.service.j2 b/roles/ceph-prometheus/templates/alertmanager.service.j2 index cabcedd05..d931793dc 100644 --- a/roles/ceph-prometheus/templates/alertmanager.service.j2 +++ b/roles/ceph-prometheus/templates/alertmanager.service.j2 @@ -14,6 +14,7 @@ WorkingDirectory={{ alertmanager_data_dir }} EnvironmentFile=-/etc/environment {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage alertmanager {% endif %} ExecStartPre=-/usr/bin/{{ container_binary }} rm -f alertmanager ExecStart=/usr/bin/{{ container_binary }} run --rm --name=alertmanager \ diff --git a/roles/ceph-prometheus/templates/prometheus.service.j2 b/roles/ceph-prometheus/templates/prometheus.service.j2 index a82c5bfb6..abc99f349 100644 --- a/roles/ceph-prometheus/templates/prometheus.service.j2 +++ b/roles/ceph-prometheus/templates/prometheus.service.j2 @@ -13,6 +13,7 @@ After=network.target EnvironmentFile=-/etc/environment {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage prometheus {% endif %} ExecStartPre=-/usr/bin/{{ container_binary }} rm -f prometheus ExecStart=/usr/bin/{{ container_binary }} run --rm --name=prometheus \ diff --git a/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 b/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 index ba9a9e32e..949ef7357 100644 --- a/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 +++ b/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 @@ -11,6 +11,7 @@ After=network.target EnvironmentFile=-/etc/environment {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage ceph-rbd-mirror-{{ ansible_hostname }} {% else %} ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-rbd-mirror-{{ ansible_hostname }} {% endif %} diff --git a/roles/ceph-rgw/templates/ceph-radosgw.service.j2 b/roles/ceph-rgw/templates/ceph-radosgw.service.j2 index 657ca70c6..1e92b90bf 100644 --- a/roles/ceph-rgw/templates/ceph-radosgw.service.j2 +++ b/roles/ceph-rgw/templates/ceph-radosgw.service.j2 @@ -12,6 +12,7 @@ After=network.target EnvironmentFile=/var/lib/ceph/radosgw/{{ cluster }}-%i/EnvironmentFile {% if container_binary == 'podman' %} ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid +ExecStartPre=-/usr/bin/{{ container_binary }} rm --ignore --storage ceph-rgw-{{ ansible_hostname }}-${INST_NAME} {% else %} ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-rgw-{{ ansible_hostname }}-${INST_NAME} {% endif %} -- 2.39.5