diff --git a/cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_api.py b/cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_api.py index 674629d1315..a2f4c3d7082 100644 --- a/cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_api.py +++ b/cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_api.py @@ -508,9 +508,10 @@ class SSHUtilTests(test.TestCase): self.sshutil.execute_command, ssh, 'ls') wait_on_stdout.assert_not_called() - @ddt.data('Password:', - 'Password: ', - 'Password: \n\n') + @ddt.data(b'Password:', + b'Password: ', + b'Password: \n\n', + b'Fake response \r\n Password: \n\n') def test_execute_command_with_prompt(self, response): ssh = mock.Mock(paramiko.SSHClient) stdin, stdout, stderr = self._mock_ssh_channel_files(paramiko.Channel) @@ -533,7 +534,7 @@ class SSHUtilTests(test.TestCase): ssh = mock.Mock(paramiko.SSHClient) stdin, stdout, stderr = self._mock_ssh_channel_files(paramiko.Channel) stdout_read = self.mock_object(stdout.channel, 'recv', - return_value='bad response') + return_value=b'bad response') self.mock_object(ssh, 'exec_command', return_value=(stdin, stdout, stderr)) diff --git a/cinder/volume/drivers/netapp/dataontap/client/api.py b/cinder/volume/drivers/netapp/dataontap/client/api.py index accbd13044d..091ac03e222 100644 --- a/cinder/volume/drivers/netapp/dataontap/client/api.py +++ b/cinder/volume/drivers/netapp/dataontap/client/api.py @@ -596,7 +596,7 @@ class SSHUtil(object): stdin, stdout, stderr = client.exec_command(command) self._wait_on_stdout(stdout, timeout) 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 " "received [%(output)s]") % { 'expected': expected_prompt_text, diff --git a/releasenotes/notes/bug-1914639-fix-chap-auth-issue-in-netapp-driver-e92eaa431d6fcbac.yaml b/releasenotes/notes/bug-1914639-fix-chap-auth-issue-in-netapp-driver-e92eaa431d6fcbac.yaml new file mode 100644 index 00000000000..6aed5cdc749 --- /dev/null +++ b/releasenotes/notes/bug-1914639-fix-chap-auth-issue-in-netapp-driver-e92eaa431d6fcbac.yaml @@ -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 `_ + for more details.