]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
iscsi: do not use ceph/daemon entrypoint
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 5 Oct 2022 02:00:20 +0000 (04:00 +0200)
committerTeoman ONAY <tonay@redhat.com>
Wed, 31 May 2023 21:07:13 +0000 (23:07 +0200)
This changes the entrypoint used for the iscsigw containerized daemons
in the systemd template.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-iscsi-gw/tasks/containerized.yml
roles/ceph-iscsi-gw/templates/rbd-target-api.service.j2
roles/ceph-iscsi-gw/templates/rbd-target-gw.service.j2
roles/ceph-iscsi-gw/templates/tcmu-runner.service.j2

index bea446ded9cb5e34b79371b5ae5d0cb251e7b456..c0369c04ec0ff101c4a6b6f69feada45601e2a9c 100644 (file)
@@ -1,4 +1,12 @@
 ---
+- name: create /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}
+  file:
+    path: "/var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}"
+    state: directory
+    owner: "{{ ceph_uid }}"
+    group: "{{ ceph_uid }}"
+    mode: "{{ ceph_directories_mode }}"
+
 - name: create rbd target log directories
   file:
     path: '/var/log/{{ item }}'
index 6baf1293fe8a2b02828286729784b8f6f64630ca..5683a0402ac9b5aefa15ec9d536c9d5bd98a9712 100644 (file)
@@ -18,6 +18,7 @@ ExecStartPre=-/usr/bin/mkdir -p /var/log/rbd-target-api
 ExecStartPre=-/usr/bin/{{ container_binary }} stop rbd-target-api
 {% endif %}
 ExecStartPre=-/usr/bin/{{ container_binary }} rm rbd-target-api
+ExecStartPre=-/usr/bin/sh -c "if ! grep -qs /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }} /proc/mounts; then mount -t configfs none /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}; fi"
 ExecStart=/usr/bin/{{ container_binary }} run --rm \
 {% if container_binary == 'podman' %}
   -d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
@@ -33,16 +34,16 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm \
   -v /lib/modules:/lib/modules \
   -v /etc/ceph:/etc/ceph \
   -v /var/log/rbd-target-api:/var/log/rbd-target-api:z \
-  -e CLUSTER={{ cluster }} \
-  -e CEPH_DAEMON=RBD_TARGET_API \
-  -e CONTAINER_IMAGE={{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \
+  -v /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}:/sys/kernel/config \
   --name=rbd-target-api \
+  --entrypoint=/usr/bin/rbd-target-api \
   {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
 {% if container_binary == 'podman' %}
 ExecStop=-/usr/bin/sh -c "/usr/bin/{{ container_binary }} rm -f `cat /%t/%n-cid`"
 {% else %}
 ExecStopPost=-/usr/bin/{{ container_binary }} stop rbd-target-api
 {% endif %}
+ExecStopPost=-/usr/bin/sh -c "if grep -qs /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }} /proc/mounts; then umount /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}; fi"
 KillMode=none
 Restart=always
 RestartSec=10s
index 754a22d0a7f7cdf6cf5694cc688e0018ef915196..1d3a386a50063d0f433916a296821f0a6d4f7151 100644 (file)
@@ -18,6 +18,7 @@ ExecStartPre=-/usr/bin/mkdir -p /var/log/rbd-target-gw
 ExecStartPre=-/usr/bin/{{ container_binary }} stop rbd-target-gw
 {% endif %}
 ExecStartPre=-/usr/bin/{{ container_binary }} rm rbd-target-gw
+ExecStartPre=-/usr/bin/sh -c "if ! grep -qs /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }} /proc/mounts; then mount -t configfs none /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}; fi"
 ExecStart=/usr/bin/{{ container_binary }} run --rm \
 {% if container_binary == 'podman' %}
   -d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
@@ -33,16 +34,16 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm \
   -v /lib/modules:/lib/modules \
   -v /etc/ceph:/etc/ceph \
   -v /var/log/rbd-target-gw:/var/log/rbd-target-gw:z \
-  -e CLUSTER={{ cluster }} \
-  -e CEPH_DAEMON=RBD_TARGET_GW \
-  -e CONTAINER_IMAGE={{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \
+  -v /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}:/sys/kernel/config \
   --name=rbd-target-gw \
+  --entrypoint=/usr/bin/rbd-target-gw \
   {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
 {% if container_binary == 'podman' %}
 ExecStop=-/usr/bin/sh -c "/usr/bin/{{ container_binary }} rm -f `cat /%t/%n-cid`"
 {% else %}
 ExecStopPost=-/usr/bin/{{ container_binary }} stop rbd-target-gw
 {% endif %}
+ExecStopPost=-/usr/bin/sh -c "if grep -qs /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }} /proc/mounts; then umount /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}; fi"
 KillMode=none
 Restart=always
 RestartSec=10s
index c0dae539a0f269c4a58a3438ce06ba5d4ee2f105..6391021bb3efd705b8898dda0b9f983dcc90f726 100644 (file)
@@ -18,6 +18,7 @@ ExecStartPre=-/usr/bin/mkdir -p /var/log/tcmu-runner
 ExecStartPre=-/usr/bin/{{ container_binary }} stop tcmu-runner
 {% endif %}
 ExecStartPre=-/usr/bin/{{ container_binary }} rm tcmu-runner
+ExecStartPre=-/usr/bin/sh -c "if ! grep -qs /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }} /proc/mounts; then mount -t configfs none /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}; fi"
 ExecStart=/usr/bin/{{ container_binary }} run --rm \
 {% if container_binary == 'podman' %}
   -d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
@@ -32,16 +33,17 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm \
   -v /lib/modules:/lib/modules \
   -v /etc/ceph:/etc/ceph \
   -v /var/log/tcmu-runner:/var/log/tcmu-runner:z \
-  -e CLUSTER={{ cluster }} \
-  -e CEPH_DAEMON=TCMU_RUNNER \
-  -e CONTAINER_IMAGE={{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \
+  -v /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}:/sys/kernel/config \
   --name=tcmu-runner \
-  {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
+  --entrypoint=tcmu-runner \
+  {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \
+  --tcmu-log-dir /var/log/tcmu-runner
 {% if container_binary == 'podman' %}
 ExecStop=-/usr/bin/sh -c "/usr/bin/{{ container_binary }} rm -f `cat /%t/%n-cid`"
 {% else %}
 ExecStopPost=-/usr/bin/{{ container_binary }} stop tcmu-runner
 {% endif %}
+ExecStopPost=-/usr/bin/sh -c "if grep -qs /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }} /proc/mounts; then umount /var/lib/ceph/iscsi.{{ ansible_facts['hostname'] }}; fi"
 KillMode=none
 Restart=always
 RestartSec=10s