inspur: transfer 'rw' to 'rwx' when Shared File Systems protocol is cifs

'rw' means is read\write\create\delete file in manila.
But it is only read\write file in AS13000.
The 'rwx' in AS13000 does the same thing as 'rw' in manila.

Co-Authored-By: Brin Zhang <zhangbailin@inspur.com>

Closes-Bug: #1797291
Change-Id: Id1453e86f3179ef5bca3e349c6e7c58ff7f991c8
This commit is contained in:
shaoxj 2018-10-03 10:29:36 +08:00 committed by zhangbailin
parent e6a50fb945
commit 9f06403d73
3 changed files with 12 additions and 3 deletions

View File

@ -464,9 +464,12 @@ class AS13000ShareDriver(driver.ShareDriver):
@staticmethod @staticmethod
def transfer_rule_to_client(proto, rule): def transfer_rule_to_client(proto, rule):
"""transfer manila access rule to backend client""" """transfer manila access rule to backend client"""
access_level = rule['access_level']
if proto == 'cifs' and access_level == 'rw':
access_level = 'rwx'
return dict(name=rule['access_to'], return dict(name=rule['access_to'],
type=(0 if proto == 'nfs' else 1), type=(0 if proto == 'nfs' else 1),
authority=rule['access_level']) authority=access_level)
@inspur_driver_debug_trace @inspur_driver_debug_trace
def update_access(self, context, share, access_rules, add_rules, def update_access(self, context, share, access_rules, add_rules,

View File

@ -646,13 +646,15 @@ class AS13000ShareDriverTestCase(test.TestCase):
mock_gsfs.assert_called_once_with('/P/share_fakeinstanceid') mock_gsfs.assert_called_once_with('/P/share_fakeinstanceid')
mock_rest.assert_not_called() mock_rest.assert_not_called()
@ddt.data('nfs', 'icfs') @ddt.data('nfs', 'icfs', 'cifs')
def test_transfer_rule_to_client(self, proto): def test_transfer_rule_to_client(self, proto):
rule = {'access_to': '1.1.1.1', 'access_level': 'rw'} rule = {'access_to': '1.1.1.1', 'access_level': 'rw'}
result = self.driver.transfer_rule_to_client(proto, rule) result = self.driver.transfer_rule_to_client(proto, rule)
client = {'name': '1.1.1.1', 'authority': 'rw'} client = {'name': '1.1.1.1',
'authority': 'rwx' if proto == 'cifs' else 'rw'}
if proto == 'nfs': if proto == 'nfs':
client.update({'type': 0}) client.update({'type': 0})
else: else:

View File

@ -0,0 +1,4 @@
---
fixes:
- Fixed CIFS permission issue with Inspur AS13000 driver so that files and
folders can be created and deleted correctly.