From ce6e411e48f2d407286ddcf5ab8e966683e16c97 Mon Sep 17 00:00:00 2001
From: Eric Harney <eharney@redhat.com>
Date: Fri, 22 Feb 2013 11:27:29 -0500
Subject: [PATCH] Only use iscsi_helper config option if using LVMISCSIDriver

_get_iscsi_properties checks for iscsi_helper == 'tgtadm',
but this is run for drivers other than LVMISCSIDriver.

Only change target_lun based on iscsi_helper if using
LVMISCSIDriver/ThinLVMVolumeDriver.

Change-Id: I8c63f8d4097682c875bbfdfade665fdacbcf8e22
---
 cinder/volume/driver.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py
index 183d6c8f6..4ee0a1920 100644
--- a/cinder/volume/driver.py
+++ b/cinder/volume/driver.py
@@ -277,7 +277,10 @@ class ISCSIDriver(VolumeDriver):
         try:
             properties['target_lun'] = int(results[2])
         except (IndexError, ValueError):
-            if self.configuration.iscsi_helper == 'tgtadm':
+            if (self.configuration.volume_driver in
+                    ['cinder.volume.drivers.lvm.LVMISCSIDriver',
+                     'cinder.volume.drivers.lvm.ThinLVMVolumeDriver'] and
+                    self.configuration.iscsi_helper == 'tgtadm'):
                 properties['target_lun'] = 1
             else:
                 properties['target_lun'] = 0
-- 
2.45.2