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
This commit is contained in:
Walter A. Boring IV 2014-01-21 11:54:15 -08:00
parent f67050b501
commit 28b8ecc15d
1 changed files with 3 additions and 2 deletions

View File

@ -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):