diff --git a/manila/share/drivers/quobyte/quobyte.py b/manila/share/drivers/quobyte/quobyte.py index dca98ef4a3..7563b4328a 100644 --- a/manila/share/drivers/quobyte/quobyte.py +++ b/manila/share/drivers/quobyte/quobyte.py @@ -218,8 +218,8 @@ class QuobyteShareDriver(driver.ExecuteMixin, driver.ShareDriver,): self._get_project_name(context, share['project_id'])) self.rpc.call('exportVolume', dict( volume_uuid=volume_uuid, - read_only='access_level' == (manila.common.constants. - ACCESS_LEVEL_RO), + read_only=access['access_level'] == (manila.common.constants. + ACCESS_LEVEL_RO), add_allow_ip=access['access_to'])) def deny_access(self, context, share, access, share_server=None): diff --git a/manila/tests/share/drivers/quobyte/test_quobyte.py b/manila/tests/share/drivers/quobyte/test_quobyte.py index c527fb4499..a545cbc6d9 100644 --- a/manila/tests/share/drivers/quobyte/test_quobyte.py +++ b/manila/tests/share/drivers/quobyte/test_quobyte.py @@ -170,6 +170,24 @@ class QuobyteShareDriverTestCase(test.TestCase): 'read_only': False, 'add_allow_ip': '10.0.0.1'}) + def test_allow_ro_access(self): + def rpc_handler(name, *args): + if name == 'resolveVolumeName': + return {'volume_uuid': 'voluuid'} + elif name == 'exportVolume': + return {'nfs_server_ip': '10.10.1.1', + 'nfs_export_path': '/voluuid'} + + self._driver.rpc.call = mock.Mock(wraps=rpc_handler) + ro_access = fake_share.fake_access(access_level='ro') + + self._driver.allow_access(self._context, self.share, ro_access) + + self._driver.rpc.call.assert_called_with( + 'exportVolume', {'volume_uuid': 'voluuid', + 'read_only': True, + 'add_allow_ip': '10.0.0.1'}) + def test_allow_access_nonip(self): self._driver.rpc.call = mock.Mock(wraps=fake_rpc_handler)