From a23795e83bbae8d52d9a47570a74d1e509bdc2f1 Mon Sep 17 00:00:00 2001 From: Francesco Pantano Date: Thu, 13 Apr 2023 23:07:58 +0200 Subject: [PATCH] Stop using ceph/daemon entrypoint Due to the recent Ceph 6 (Quincy) container image refactoring, the old entrypoint is no longer available. However, the ceph-nfs systemd unit should support both Pacific and Quincy releases. This patch introduces a task that is able to detect the version provided by the ceph container in the Heat stack and renders the systemd unit accordingly. Change-Id: I34537db460ff5aaba93da7e104262e26e64cbb1a --- .../roles/tripleo_cephadm/defaults/main.yml | 1 + .../tasks/ganesha/distribute_keys.yaml | 1 + .../roles/tripleo_cephadm/tasks/nfs.yaml | 7 +++++++ .../tripleo_cephadm/templates/ceph-nfs.service.j2 | 13 +++++++++++-- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tripleo_ansible/roles/tripleo_cephadm/defaults/main.yml b/tripleo_ansible/roles/tripleo_cephadm/defaults/main.yml index c16d7ce37..7f9c3c8e6 100644 --- a/tripleo_ansible/roles/tripleo_cephadm/defaults/main.yml +++ b/tripleo_ansible/roles/tripleo_cephadm/defaults/main.yml @@ -77,3 +77,4 @@ tripleo_cephadm_nfs_ingress_frontend_port: 2049 tripleo_cephadm_nfs_ingress_monitor_port: 8999 tripleo_cephadm_ceph_vips: {} tripleo_cephadm_extra_args: "" +tripleo_cephadm_pacific_filter: "16.*" diff --git a/tripleo_ansible/roles/tripleo_cephadm/tasks/ganesha/distribute_keys.yaml b/tripleo_ansible/roles/tripleo_cephadm/tasks/ganesha/distribute_keys.yaml index 912cb5d6f..4e7d0b53d 100644 --- a/tripleo_ansible/roles/tripleo_cephadm/tasks/ganesha/distribute_keys.yaml +++ b/tripleo_ansible/roles/tripleo_cephadm/tasks/ganesha/distribute_keys.yaml @@ -27,6 +27,7 @@ - "/var/log/ceph" - "/var/run/ceph" - "/var/lib/ceph/bootstrap-rgw" + - "/var/lib/nfs/rpc_pipefs/nfs" - "/var/lib/ceph/radosgw/ceph-rgw.{{ tripleo_cephadm_ceph_nfs_ceph_user }}" - "/var/lib/ceph/radosgw/{{ tripleo_cephadm_cluster }}-rgw.{{ nfs_node }}" diff --git a/tripleo_ansible/roles/tripleo_cephadm/tasks/nfs.yaml b/tripleo_ansible/roles/tripleo_cephadm/tasks/nfs.yaml index 28b2af9ad..2cd3dcc59 100644 --- a/tripleo_ansible/roles/tripleo_cephadm/tasks/nfs.yaml +++ b/tripleo_ansible/roles/tripleo_cephadm/tasks/nfs.yaml @@ -94,11 +94,18 @@ changed_when: false delegate_to: "{{ groups['ceph_nfs'][0] }}" +- name: Get Ceph version + command: "{{ tripleo_cephadm_container_cli }} run --rm --entrypoint=ceph {{ ceph_container }} -v" + register: ceph_version + vars: + ceph_container: "{{ tripleo_cephadm_container_ns }}/{{ tripleo_cephadm_container_image }}:{{ tripleo_cephadm_container_tag }}" + - name: Render Ganesha templates and files include_tasks: ganesha/start_nfs.yaml vars: nfs_node: "{{ node }}" dbus_ganesha_file: "{{ _dbus_ganesha }}" + tripleo_cephadm_ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}" loop: "{{ groups['ceph_nfs'] }}" loop_control: loop_var: node diff --git a/tripleo_ansible/roles/tripleo_cephadm/templates/ceph-nfs.service.j2 b/tripleo_ansible/roles/tripleo_cephadm/templates/ceph-nfs.service.j2 index 8380c00ef..159c78780 100644 --- a/tripleo_ansible/roles/tripleo_cephadm/templates/ceph-nfs.service.j2 +++ b/tripleo_ansible/roles/tripleo_cephadm/templates/ceph-nfs.service.j2 @@ -22,16 +22,25 @@ ExecStart=/usr/bin/{{ container_cli }} run --rm --net=host \ -v /var/run/ceph:/var/run/ceph:z \ -v /var/log/ceph:/var/log/ceph:z \ -v /var/log/ganesha:/var/log/ganesha:z \ + -v /etc/localtime:/etc/localtime:ro \ + -v /var/lib/nfs/rpc_pipefs/nfs:/var/lib/nfs/rpc_pipefs/nfs \ + --name=ceph-nfs-{{ tripleo_cephadm_ceph_nfs_service_suffix | default(ansible_facts['hostname']) }} \ {% if tripleo_cephadm_ceph_nfs_dynamic_exports | bool %} --privileged \ -v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket \ {% endif -%} - -v /etc/localtime:/etc/localtime:ro \ + {# Ceph Pacific is defined in the form "v16.x.y": filtering "16.*" is enough #} + {% if (tripleo_cephadm_ceph_version is defined) and + (tripleo_cephadm_ceph_version is match(tripleo_cephadm_pacific_filter)) %} -e CLUSTER={{ tripleo_cephadm_cluster }} \ -e CEPH_DAEMON=NFS \ -e CONTAINER_IMAGE={{ tripleo_cephadm_container_ns }}/{{ tripleo_cephadm_container_image }}:{{ tripleo_cephadm_container_tag }} \ - --name=ceph-nfs-{{ tripleo_cephadm_ceph_nfs_service_suffix | default(ansible_facts['hostname']) }} \ {{ tripleo_cephadm_container_ns }}/{{ tripleo_cephadm_container_image }}:{{ tripleo_cephadm_container_tag }} + {% else %} + --entrypoint=/bin/sh \ + {{ tripleo_cephadm_container_ns }}/{{ tripleo_cephadm_container_image }}:{{ tripleo_cephadm_container_tag }} \ + -c 'rpcbind && rpc.statd -L && rpc.idmapd && /usr/bin/ganesha.nfsd -F -L STDOUT' + {% endif -%} ExecStop=-/usr/bin/sh -c "/usr/bin/{{ container_cli }} rm -f `cat /%t/%n-cid`" KillMode=none Restart=always