Change a parameter key for CIFS mounting command
While Huawei driver mounting CIFS filesystem, the username parameter key passed to the mount command is by the form of "user=***", which's compatible as "username=***" in Ubuntu. However, for some other systems, such as Redhat, it is not valid. This patch changes it to the more compatible form "username=***". Change-Id: Ifa2ca7bcdceef2d47e2841a27ddf51d86f1ef63c Closes-Bug: #1740816
This commit is contained in:
parent
426c3b83ad
commit
5ef160ca75
@ -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'],
|
||||
|
@ -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):
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Change the CIFS mounting parameter of Huawei driver from form "user=" to
|
||||
"username=", which is compatible in various OS.
|
Loading…
Reference in New Issue
Block a user