Merge "[NetApp] Fix iSCSI CHAP auth issue during volume attach"

This commit is contained in:
Zuul 2022-06-28 21:41:17 +00:00 committed by Gerrit Code Review
commit ed6bef65b9
3 changed files with 13 additions and 5 deletions

View File

@ -508,9 +508,10 @@ class SSHUtilTests(test.TestCase):
self.sshutil.execute_command, ssh, 'ls') self.sshutil.execute_command, ssh, 'ls')
wait_on_stdout.assert_not_called() wait_on_stdout.assert_not_called()
@ddt.data('Password:', @ddt.data(b'Password:',
'Password: ', b'Password: ',
'Password: \n\n') b'Password: \n\n',
b'Fake response \r\n Password: \n\n')
def test_execute_command_with_prompt(self, response): def test_execute_command_with_prompt(self, response):
ssh = mock.Mock(paramiko.SSHClient) ssh = mock.Mock(paramiko.SSHClient)
stdin, stdout, stderr = self._mock_ssh_channel_files(paramiko.Channel) stdin, stdout, stderr = self._mock_ssh_channel_files(paramiko.Channel)
@ -533,7 +534,7 @@ class SSHUtilTests(test.TestCase):
ssh = mock.Mock(paramiko.SSHClient) ssh = mock.Mock(paramiko.SSHClient)
stdin, stdout, stderr = self._mock_ssh_channel_files(paramiko.Channel) stdin, stdout, stderr = self._mock_ssh_channel_files(paramiko.Channel)
stdout_read = self.mock_object(stdout.channel, 'recv', stdout_read = self.mock_object(stdout.channel, 'recv',
return_value='bad response') return_value=b'bad response')
self.mock_object(ssh, 'exec_command', self.mock_object(ssh, 'exec_command',
return_value=(stdin, stdout, stderr)) return_value=(stdin, stdout, stderr))

View File

@ -596,7 +596,7 @@ class SSHUtil(object):
stdin, stdout, stderr = client.exec_command(command) stdin, stdout, stderr = client.exec_command(command)
self._wait_on_stdout(stdout, timeout) self._wait_on_stdout(stdout, timeout)
response = stdout.channel.recv(999) response = stdout.channel.recv(999)
if response.strip() != expected_prompt_text: if expected_prompt_text not in response.strip().decode():
msg = _("Unexpected output. Expected [%(expected)s] but " msg = _("Unexpected output. Expected [%(expected)s] but "
"received [%(output)s]") % { "received [%(output)s]") % {
'expected': expected_prompt_text, 'expected': expected_prompt_text,

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Fixed a CHAP authentication issue while trying to attach an iSCSI volume
using the NetApp ONTAP driver. Please refer to the
`Launchpad bug #1914639 <https://bugs.launchpad.net/cinder/+bug/1914639>`_
for more details.