From 138c6426bdcdab6f6b623d51268a225340654e74 Mon Sep 17 00:00:00 2001
From: Takeaki Matsumoto <takeaki.matsumoto@ntt.com>
Date: Tue, 5 Jul 2016 18:23:32 +0900
Subject: [PATCH] Add enable_iscsi option to etc/kolla/globals.yml

To use Cinder LVM2 backend with iSCSI,
add enable_iscsi option and fix document.

Change-Id: I286733508b5582c311c313c172b3c3a774be993c
Closes-Bug: #1599088
---
 ansible/roles/cinder/templates/cinder.conf.j2 | 2 +-
 doc/cinder-guide.rst                          | 6 +++---
 etc/kolla/globals.yml                         | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/ansible/roles/cinder/templates/cinder.conf.j2 b/ansible/roles/cinder/templates/cinder.conf.j2
index d1ff2b33bc..77449814c9 100644
--- a/ansible/roles/cinder/templates/cinder.conf.j2
+++ b/ansible/roles/cinder/templates/cinder.conf.j2
@@ -76,7 +76,7 @@ rabbit_hosts = {% for host in groups['rabbitmq'] %}{{ hostvars[host]['ansible_'
 volume_group = {{ cinder_volume_group }}
 volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
 volume_backend_name = {{ cinder_volume_backend_name }}
-iscsi_ip_address = {{ cinder_iscsi_ip_address }}
+iscsi_ip_address = {{ hostvars[groups['tgtd'][0]]['ansible_' + hostvars[groups['tgtd'][0]]['storage_interface']]['ipv4']['address'] }}
 iscsi_helper = {{ cinder_iscsi_helper }}
 iscsi_protocol = {{ cinder_iscsi_protocol }}
 {% elif cinder_volume_driver == "ceph" %}
diff --git a/doc/cinder-guide.rst b/doc/cinder-guide.rst
index 05b5b3b5f2..9200ac2846 100644
--- a/doc/cinder-guide.rst
+++ b/doc/cinder-guide.rst
@@ -98,13 +98,13 @@ between nova-compute process and the server hosting LVG.
 In order to use iSCSI as a Cinder's backend, these two parameters must be
 specified in ``globals.yml``. ::
 
-    cinder_iscsi_ip_address: "X.X.X.X"
+    enable_iscsi: "yes"
+
     cinder_volume_group: << lvg_name >>
 
 
-Where: 
+Where:
 
-- X.X.X.X - is IP address of a server hosting LVG
 - ``lvg_name`` - is a name of LVG on that server.
 
 NOTE: For Ubuntu and LVM2/iSCSI
diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml
index d81732e8ad..47b450cdfd 100644
--- a/etc/kolla/globals.yml
+++ b/etc/kolla/globals.yml
@@ -114,6 +114,7 @@ neutron_external_interface: "eth1"
 #enable_heat: "yes"
 #enable_horizon: "yes"
 #enable_ironic: "no"
+#enable_iscsi: "no"
 #enable_magnum: "no"
 #enable_manila: "no"
 #enable_mistral: "no"
@@ -144,7 +145,6 @@ neutron_external_interface: "eth1"
 # Cinder's iSCSI backend !!!REQUIRES!!! two parameters:
 # 1 - IP address of the server hosting LVM Volume group
 # 2 - The name of Volume group which Cinder will use.
-#cinder_iscsi_ip_address:
 #cinder_volume_group: