ceph-iscsi: notify rbd target services

When the iscsi gateway or the ceph configuration file change then we
need to notify the rbd target api/gw services to be restarted.
This patch also merges the rbd-target-api and rbd-target-gw handler
into a single file and listen.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit bc701860d5)
pull/4619/head
Dimitri Savineau 2019-10-09 16:50:09 -04:00 committed by Dimitri Savineau
parent 0b49538621
commit 86b7137b27
6 changed files with 35 additions and 35 deletions

View File

@ -91,6 +91,7 @@
- restart ceph rgws - restart ceph rgws
- restart ceph mgrs - restart ceph mgrs
- restart ceph rbdmirrors - restart ceph rbdmirrors
- restart ceph rbd-target-api-gw
- name: "ensure fetch directory exists" - name: "ensure fetch directory exists"
run_once: true run_once: true
@ -149,3 +150,4 @@
- restart ceph rgws - restart ceph rgws
- restart ceph mgrs - restart ceph mgrs
- restart ceph rbdmirrors - restart ceph rbdmirrors
- restart ceph rbd-target-api-gw

View File

@ -49,12 +49,7 @@
when: iscsi_gw_group_name in group_names when: iscsi_gw_group_name in group_names
listen: "restart ceph tcmu-runner" listen: "restart ceph tcmu-runner"
- name: rbd-target-gw handler - name: rbd-target-api and rbd-target-gw handler
include_tasks: handler_rbd_target_gw.yml include_tasks: handler_rbd_target_api_gw.yml
when: iscsi_gw_group_name in group_names when: iscsi_gw_group_name in group_names
listen: "restart ceph rbd-target-gw" listen: "restart ceph rbd-target-api-gw"
- name: rbd-target-api handler
include_tasks: handler_rbd_target_api.yml
when: iscsi_gw_group_name in group_names
listen: "restart ceph rbd-target-api"

View File

@ -24,3 +24,29 @@
- name: set _rbd_target_api_handler_called after restart - name: set _rbd_target_api_handler_called after restart
set_fact: set_fact:
_rbd_target_api_handler_called: False _rbd_target_api_handler_called: False
- name: set _rbd_target_gw_handler_called before restart
set_fact:
_rbd_target_gw_handler_called: True
- name: copy rbd-target-gw restart script
template:
src: restart_rbd_target_gw.sh.j2
dest: /tmp/restart_rbd_target_gw.sh
owner: root
group: root
mode: 0750
- name: restart rbd-target-gw
command: /usr/bin/env bash /tmp/restart_rbd_target_gw.sh
when:
- ceph_rbd_target_gw_stat.get('rc') == 0
- hostvars[item]['_rbd_target_gw_handler_called'] | default(False) | bool
- ceph_rbd_target_gw_stat.get('stdout_lines', [])|length != 0
with_items: "{{ groups[iscsi_gw_group_name] }}"
delegate_to: "{{ item }}"
run_once: True
- name: set _rbd_target_gw_handler_called after restart
set_fact:
_rbd_target_gw_handler_called: False

View File

@ -1,26 +0,0 @@
---
- name: set _rbd_target_gw_handler_called before restart
set_fact:
_rbd_target_gw_handler_called: True
- name: copy rbd-target-gw restart script
template:
src: restart_rbd_target_gw.sh.j2
dest: /tmp/restart_rbd_target_gw.sh
owner: root
group: root
mode: 0750
- name: restart rbd-target-gw
command: /usr/bin/env bash /tmp/restart_rbd_target_gw.sh
when:
- ceph_rbd_target_gw_stat.get('rc') == 0
- hostvars[item]['_rbd_target_gw_handler_called'] | default(False) | bool
- ceph_rbd_target_gw_stat.get('stdout_lines', [])|length != 0
with_items: "{{ groups[iscsi_gw_group_name] }}"
delegate_to: "{{ item }}"
run_once: True
- name: set _rbd_target_gw_handler_called after restart
set_fact:
_rbd_target_gw_handler_called: False

View File

@ -28,6 +28,7 @@
dest: /etc/ceph/iscsi-gateway.cfg dest: /etc/ceph/iscsi-gateway.cfg
config_type: ini config_type: ini
config_overrides: '{{ iscsi_conf_overrides }}' config_overrides: '{{ iscsi_conf_overrides }}'
notify: restart ceph rbd-target-api-gw
- name: set_fact container_exec_cmd - name: set_fact container_exec_cmd
set_fact: set_fact:

View File

@ -11,4 +11,6 @@
- tcmu-runner - tcmu-runner
- rbd-target-gw - rbd-target-gw
- rbd-target-api - rbd-target-api
notify: restart ceph {{ item }} notify:
- restart ceph tcmu-runner
- restart ceph rbd-target-api-gw