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:
shaoxjandBrin Zhang authored and zhangbailin committed 2018-10-30 05:18:42 -04:00
1 parent e6a50fb945
commit 9f06403d73
3 files changed
+12 -3

No files matched your search

@@ -464,9 +464,12 @@ class AS13000ShareDriver(driver.ShareDriver):
@staticmethod
def transfer_rule_to_client(proto, rule):
"""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'],
type=(0 if proto == 'nfs' else 1),
authority=rule['access_level'])
authority=access_level)
@inspur_driver_debug_trace
def update_access(self, context, share, access_rules, add_rules,
@@ -646,13 +646,15 @@ class AS13000ShareDriverTestCase(test.TestCase):
mock_gsfs.assert_called_once_with('/P/share_fakeinstanceid')
mock_rest.assert_not_called()
@ddt.data('nfs', 'icfs')
@ddt.data('nfs', 'icfs', 'cifs')
def test_transfer_rule_to_client(self, proto):
rule = {'access_to': '1.1.1.1', 'access_level': 'rw'}
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':
client.update({'type': 0})
else:
@@ -0,0 +1,4 @@
---
fixes:
- Fixed CIFS permission issue with Inspur AS13000 driver so that files and
folders can be created and deleted correctly.