From c2a93974742c24ab0fcdcd1651a3b2dde63ddf1c Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Tue, 28 Jan 2020 16:31:55 -0600 Subject: [PATCH] iscsi: Fix crashes during rolling update During a rolling update we will run the ceph iscsigw tasks that start the daemons then run the configure_iscsi.yml tasks which can create iscsi objects like targets, disks, clients, etc. The problem is that once the daemons are started they will accept confifguration requests, or may want to update the system themself. Those operations can then conflict with the configure_iscsi.yml tasks that setup objects and we can end up in crashes due to the kernel being in a unsupported state. This could also happen during creation, but is less likely due to no objects being setup yet, so there are no watchers or users accessing the gws yet. The fix in this patch works for both update and initial setup. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1795806 Signed-off-by: Mike Christie (cherry picked from commit 77f3b5d51b84a6338847c5f6a93f22a3a6a683d2) --- roles/ceph-iscsi-gw/tasks/main.yml | 4 ++++ .../tasks/non-container/postrequisites.yml | 9 +++++++++ .../tasks/non-container/prerequisites.yml | 15 +++++++-------- 3 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 roles/ceph-iscsi-gw/tasks/non-container/postrequisites.yml diff --git a/roles/ceph-iscsi-gw/tasks/main.yml b/roles/ceph-iscsi-gw/tasks/main.yml index 77cfe618e..297eb4d88 100644 --- a/roles/ceph-iscsi-gw/tasks/main.yml +++ b/roles/ceph-iscsi-gw/tasks/main.yml @@ -20,6 +20,10 @@ when: - not containerized_deployment +- name: include non-container/postrequisites.yml + include_tasks: non-container/postrequisites.yml + when: not containerized_deployment | bool + - name: include containerized.yml include_tasks: container/containerized.yml when: diff --git a/roles/ceph-iscsi-gw/tasks/non-container/postrequisites.yml b/roles/ceph-iscsi-gw/tasks/non-container/postrequisites.yml new file mode 100644 index 000000000..5242525ef --- /dev/null +++ b/roles/ceph-iscsi-gw/tasks/non-container/postrequisites.yml @@ -0,0 +1,9 @@ +- name: start rbd-target-api and rbd-target-gw + service: + name: "{{ item }}" + state: started + enabled: yes + masked: no + with_items: + - rbd-target-gw + - rbd-target-api diff --git a/roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml b/roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml index f3ed7e738..56e69be0f 100644 --- a/roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml +++ b/roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml @@ -89,14 +89,13 @@ - target.stat.exists - target.stat.islnk == False -- name: enable the rbd-target-gw service and make sure it is running +# Only start tcmu-runner, so configure_iscsi.yml can create disks. +# We must start rbd-target-gw/api after configure_iscsi.yml to avoid +# races where they are both trying to setup the same object during +# a rolling update. +- name: start tcmu-runner service: - name: rbd-target-gw - enabled: yes + name: tcmu-runner state: started - -- name: enable the rbd-target-api service and make sure it is running - service: - name: rbd-target-api enabled: yes - state: started + masked: no