From 9f06403d73094aa35a98b3c6b59f0c7f210aac27 Mon Sep 17 00:00:00 2001 From: shaoxj Date: Wed, 3 Oct 2018 10:29:36 +0800 Subject: [PATCH] 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 Closes-Bug: #1797291 Change-Id: Id1453e86f3179ef5bca3e349c6e7c58ff7f991c8 --- manila/share/drivers/inspur/as13000/as13000_nas.py | 5 ++++- .../tests/share/drivers/inspur/as13000/test_as13000_nas.py | 6 ++++-- ...ur-support-rwx-for-cifs-permission-4279f1fe7a59fd00.yaml | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/inspur-support-rwx-for-cifs-permission-4279f1fe7a59fd00.yaml diff --git a/manila/share/drivers/inspur/as13000/as13000_nas.py b/manila/share/drivers/inspur/as13000/as13000_nas.py index 29aa212c23..0dbe60b7dc 100644 --- a/manila/share/drivers/inspur/as13000/as13000_nas.py +++ b/manila/share/drivers/inspur/as13000/as13000_nas.py @@ -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, diff --git a/manila/tests/share/drivers/inspur/as13000/test_as13000_nas.py b/manila/tests/share/drivers/inspur/as13000/test_as13000_nas.py index ef7289545e..8641378aa1 100644 --- a/manila/tests/share/drivers/inspur/as13000/test_as13000_nas.py +++ b/manila/tests/share/drivers/inspur/as13000/test_as13000_nas.py @@ -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: diff --git a/releasenotes/notes/inspur-support-rwx-for-cifs-permission-4279f1fe7a59fd00.yaml b/releasenotes/notes/inspur-support-rwx-for-cifs-permission-4279f1fe7a59fd00.yaml new file mode 100644 index 0000000000..504915b1e1 --- /dev/null +++ b/releasenotes/notes/inspur-support-rwx-for-cifs-permission-4279f1fe7a59fd00.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - Fixed CIFS permission issue with Inspur AS13000 driver so that files and + folders can be created and deleted correctly.