Merge "TgtAdm: Don't change CHAP username/password on live migration"
This commit is contained in:
commit
fea2bae001
@ -50,6 +50,9 @@ class TestLioAdmDriver(test_tgt.TestTgtAdmDriver):
|
||||
def test_verify_backing_lun(self):
|
||||
pass
|
||||
|
||||
def test_get_target_chap_auth(self):
|
||||
pass
|
||||
|
||||
def test_create_iscsi_target_already_exists(self):
|
||||
def _fake_execute(*args, **kwargs):
|
||||
raise putils.ProcessExecutionError(exit_code=1)
|
||||
|
@ -249,6 +249,9 @@ class TestTgtAdmDriver(test.TestCase):
|
||||
'_verify_backing_lun',
|
||||
lambda x, y: True)
|
||||
|
||||
self.stubs.Set(self.target,
|
||||
'_get_target_chap_auth',
|
||||
lambda x: None)
|
||||
self.stubs.Set(vutils,
|
||||
'generate_username',
|
||||
lambda: 'QZJbisGmn9AL954FNF4D')
|
||||
@ -267,6 +270,19 @@ class TestTgtAdmDriver(test.TestCase):
|
||||
self.testvol_1,
|
||||
self.fake_volumes_dir))
|
||||
|
||||
self.stubs.Set(self.target,
|
||||
'_get_target_chap_auth',
|
||||
lambda x: ('otzLy2UYbYfnP4zXLG5z',
|
||||
'234Zweo38VGBBvrpK9nt'))
|
||||
|
||||
expected_result['auth'] = ('CHAP '
|
||||
'otzLy2UYbYfnP4zXLG5z 234Zweo38VGBBvrpK9nt')
|
||||
|
||||
self.assertEqual(expected_result,
|
||||
self.target.create_export(ctxt,
|
||||
self.testvol_1,
|
||||
self.fake_volumes_dir))
|
||||
|
||||
def test_ensure_export(self):
|
||||
ctxt = context.get_admin_context()
|
||||
with mock.patch.object(self.target, 'create_iscsi_target'):
|
||||
|
@ -17,6 +17,9 @@ class IetAdm(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(IetAdm, self).__init__(*args, **kwargs)
|
||||
|
||||
def _get_target_chap_auth(self, name):
|
||||
pass
|
||||
|
||||
def ensure_export(self, context, volume, volume_path):
|
||||
pass
|
||||
|
||||
|
@ -38,6 +38,9 @@ class LioAdm(TgtAdm):
|
||||
|
||||
self._verify_rtstool()
|
||||
|
||||
def _get_target_chap_auth(self, name):
|
||||
pass
|
||||
|
||||
def remove_export(self, context, volume):
|
||||
try:
|
||||
iscsi_target = self.db.volume_get_iscsi_target_num(context,
|
||||
|
@ -306,8 +306,15 @@ class TgtAdm(iscsi.ISCSITarget):
|
||||
iscsi_name = "%s%s" % (self.configuration.iscsi_target_prefix,
|
||||
volume['name'])
|
||||
iscsi_target, lun = self._get_target_and_lun(context, volume)
|
||||
chap_username = vutils.generate_username()
|
||||
chap_password = vutils.generate_password()
|
||||
|
||||
# Verify we haven't setup a CHAP creds file already
|
||||
# if DNE no big deal, we'll just create it
|
||||
current_chap_auth = self._get_target_chap_auth(iscsi_name)
|
||||
if current_chap_auth:
|
||||
(chap_username, chap_password) = current_chap_auth
|
||||
else:
|
||||
chap_username = vutils.generate_username()
|
||||
chap_password = vutils.generate_password()
|
||||
chap_auth = self._iscsi_authentication('IncomingUser', chap_username,
|
||||
chap_password)
|
||||
# NOTE(jdg): For TgtAdm case iscsi_name is the ONLY param we need
|
||||
|
Loading…
x
Reference in New Issue
Block a user