diff --git a/manila/share/drivers/huawei/v3/connection.py b/manila/share/drivers/huawei/v3/connection.py index 074fc8831b..42a190b42a 100644 --- a/manila/share/drivers/huawei/v3/connection.py +++ b/manila/share/drivers/huawei/v3/connection.py @@ -601,7 +601,7 @@ class V3StorageConnection(driver.HuaweiBase): share['mount_src']) elif share['share_proto'] == 'CIFS': - user = ('user=' + access['access_to'] + ',' + + user = ('username=' + access['access_to'] + ',' + 'password=' + access['access_password']) utils.execute('mount', '-t', 'cifs', share['mount_path'], share['mount_src'], diff --git a/manila/tests/share/drivers/huawei/test_huawei_nas.py b/manila/tests/share/drivers/huawei/test_huawei_nas.py index cda6c1f831..eee45054ea 100644 --- a/manila/tests/share/drivers/huawei/test_huawei_nas.py +++ b/manila/tests/share/drivers/huawei/test_huawei_nas.py @@ -4600,6 +4600,30 @@ class HuaweiShareDriverTestCase(test.TestCase): self.driver.revert_to_snapshot, None, snapshot, None, None) + @ddt.data({'name': 'fake_name', + 'share_proto': 'NFS', + 'mount_path': 'fake_nfs_mount_path', + 'mount_src': '/mnt/test'}, + {'name': 'fake_name', + 'share_proto': 'CIFS', + 'mount_path': 'fake_cifs_mount_path', + 'mount_src': '/mnt/test'}, + ) + def test_mount_share_to_host(self, share): + access = {'access_to': 'cifs_user', + 'access_password': 'cifs_password'} + mocker = self.mock_object(utils, 'execute') + self.driver.plugin.mount_share_to_host(share, access) + if share['share_proto'] == 'NFS': + mocker.assert_called_once_with( + 'mount', '-t', 'nfs', 'fake_nfs_mount_path', '/mnt/test', + run_as_root=True) + else: + mocker.assert_called_once_with( + 'mount', '-t', 'cifs', 'fake_cifs_mount_path', '/mnt/test', + '-o', 'username=cifs_user,password=cifs_password', + run_as_root=True) + @ddt.ddt class HuaweiDriverHelperTestCase(test.TestCase): diff --git a/releasenotes/notes/fix-huawei-driver-cifs-mount-issue-2d7bff5a7e6e3ad6.yaml b/releasenotes/notes/fix-huawei-driver-cifs-mount-issue-2d7bff5a7e6e3ad6.yaml new file mode 100644 index 0000000000..70a2b072b5 --- /dev/null +++ b/releasenotes/notes/fix-huawei-driver-cifs-mount-issue-2d7bff5a7e6e3ad6.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Change the CIFS mounting parameter of Huawei driver from form "user=" to + "username=", which is compatible in various OS.