From 28b8ecc15d874644952bb74539c61becaf5f7d20 Mon Sep 17 00:00:00 2001 From: "Walter A. Boring IV" Date: Tue, 21 Jan 2014 11:54:15 -0800 Subject: [PATCH] Fixed inconsistency in iqn Brick's TargetAdmin classes have a default value set in __init__ for iscsi_target_prefix. The unit test was changing the value returned for the internal _get_target, but wasn't changing the CONF.iscsi_target_prefix to match. So the default value in the __init__ was being used and hence the differences. This patch sets the configuration's iscsi_target_prefix which alters the values passed into the driver. This also makes the tests consistent between the iqn of the volume at create time and delete time. Closes-Bug: #1271249 Change-Id: Ie3308cf68adcbdff6057ea795af1299dded82e14 --- cinder/tests/test_iscsi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cinder/tests/test_iscsi.py b/cinder/tests/test_iscsi.py index f07c8a4f6..cc072fabf 100644 --- a/cinder/tests/test_iscsi.py +++ b/cinder/tests/test_iscsi.py @@ -47,6 +47,7 @@ class TargetAdminTestCase(object): self.stubs.Set(iscsi.TgtAdm, '_verify_backing_lun', self.fake_verify_backing_lun) self.driver = driver.ISCSIDriver() + self.flags(iscsi_target_prefix='iqn.2011-09.org.foo.bar:') def fake_verify_backing_lun(obj, iqn, tid): return True @@ -113,7 +114,7 @@ class TgtAdmTestCase(test.TestCase, TargetAdminTestCase): self.script_template = "\n".join([ 'tgt-admin --update iqn.2011-09.org.foo.bar:blaa', 'tgt-admin --force ' - '--delete iqn.2010-10.org.openstack:volume-blaa', + '--delete iqn.2011-09.org.foo.bar:volume-blaa', 'tgtadm --lld iscsi --op show --mode target']) def tearDown(self): @@ -198,7 +199,7 @@ class LioAdmTestCase(test.TestCase, TargetAdminTestCase): self.script_template = "\n".join([ 'cinder-rtstool create ' '/foo iqn.2011-09.org.foo.bar:blaa test_id test_pass', - 'cinder-rtstool delete iqn.2010-10.org.openstack:volume-blaa']) + 'cinder-rtstool delete iqn.2011-09.org.foo.bar:volume-blaa']) class ISERTgtAdmTestCase(TgtAdmTestCase): -- 2.45.2