Merge "Change a parameter key for CIFS mounting command"

This commit is contained in:
Zuul 2018-03-06 03:17:52 +00:00 committed by Gerrit Code Review
commit f6a4cf268b
3 changed files with 30 additions and 1 deletions

View File

@ -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'],

View File

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

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Change the CIFS mounting parameter of Huawei driver from form "user=" to
"username=", which is compatible in various OS.