From ee66b6468da743c018715192d5fe2829cc653865 Mon Sep 17 00:00:00 2001
From: guochao <guochao@winhong.com>
Date: Wed, 9 Aug 2017 11:34:33 +0800
Subject: [PATCH] Fix wrong condition for iscsid container

Iscsid is not only needed by cinder lvm backend, but also by ironic
conductor container.

Change-Id: I903cda88ca71ba31b30c220761f33808495aba72
Closes-Bug: #1709809
---
 ansible/roles/iscsi/tasks/config.yml | 8 ++++----
 ansible/roles/iscsi/tasks/start.yml  | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ansible/roles/iscsi/tasks/config.yml b/ansible/roles/iscsi/tasks/config.yml
index fefa3f15e0..a951dcda35 100644
--- a/ansible/roles/iscsi/tasks/config.yml
+++ b/ansible/roles/iscsi/tasks/config.yml
@@ -4,8 +4,8 @@
     path: "{{ node_config_directory }}/{{ item }}"
     state: "directory"
     recurse: yes
-  when: inventory_hostname in groups['compute'] or
-        inventory_hostname in groups['storage']
+  when: ( ( inventory_hostname in groups['compute'] or inventory_hostname in groups['cinder-volume'] ) and enable_cinder_backend_lvm | bool )
+         or ( inventory_hostname in groups['ironic-conductor'] and enable_ironic | bool )
   with_items:
     - "iscsid"
 
@@ -13,8 +13,8 @@
   template:
     src: "{{ item }}.json.j2"
     dest: "{{ node_config_directory }}/{{ item }}/config.json"
-  when: inventory_hostname in groups['compute'] or
-        inventory_hostname in groups['storage']
+  when: ( ( inventory_hostname in groups['compute'] or inventory_hostname in groups['cinder-volume'] ) and enable_cinder_backend_lvm | bool )
+         or ( inventory_hostname in groups['ironic-conductor'] and enable_ironic | bool )
   with_items:
     - "iscsid"
 
diff --git a/ansible/roles/iscsi/tasks/start.yml b/ansible/roles/iscsi/tasks/start.yml
index f1135188a8..c2934cfe22 100644
--- a/ansible/roles/iscsi/tasks/start.yml
+++ b/ansible/roles/iscsi/tasks/start.yml
@@ -18,8 +18,8 @@
       - "/sys/kernel/config:/configfs"
       - "cinder:/var/lib/cinder"
       - "iscsi_info:/etc/iscsi"
-  when: inventory_hostname in groups['compute'] or
-        inventory_hostname in groups['storage']
+  when: ( ( inventory_hostname in groups['compute'] or inventory_hostname in groups['cinder-volume'] ) and enable_cinder_backend_lvm | bool )
+         or ( inventory_hostname in groups['ironic-conductor'] and enable_ironic | bool )
 
 - name: Starting tgtd container
   kolla_docker: