diff --git a/manila/share/drivers/quobyte/quobyte.py b/manila/share/drivers/quobyte/quobyte.py index 1b21ac247a..e60f80a384 100644 --- a/manila/share/drivers/quobyte/quobyte.py +++ b/manila/share/drivers/quobyte/quobyte.py @@ -59,6 +59,10 @@ quobyte_manila_share_opts = [ cfg.StrOpt('quobyte_default_volume_group', default='root', help='Default owning group for new volumes.'), + cfg.StrOpt('quobyte_export_path', + default='/quobyte', + help='Export path for shares of this bacckend. This needs ' + 'to match the quobyte-nfs services "Pseudo" option.'), ] CONF = cfg.CONF @@ -79,9 +83,10 @@ class QuobyteShareDriver(driver.ExecuteMixin, driver.ShareDriver,): 1.2.4 - Fixed handling updated QB API error codes 1.2.5 - Fixed two quota handling bugs 1.2.6 - Fixed volume resize and jsonrpc code style bugs + 1.2.7 - Add quobyte_export_path option """ - DRIVER_VERSION = '1.2.6' + DRIVER_VERSION = '1.2.7' def __init__(self, *args, **kwargs): super(QuobyteShareDriver, self).__init__(False, *args, **kwargs) @@ -247,7 +252,7 @@ class QuobyteShareDriver(driver.ExecuteMixin, driver.ShareDriver,): self._resize_share(share, share['size']) - return '%(nfs_server_ip)s:%(nfs_export_path)s' % result + return self._build_share_export_string(result) def delete_share(self, context, share, share_server=None): """Delete the corresponding Quobyte volume.""" @@ -293,7 +298,7 @@ class QuobyteShareDriver(driver.ExecuteMixin, driver.ShareDriver,): volume_uuid=volume_uuid, protocol='NFS')) - return '%(nfs_server_ip)s:%(nfs_export_path)s' % result + return self._build_share_export_string(result) def _allow_access(self, context, share, access, share_server=None): """Allow access to a share.""" @@ -310,6 +315,12 @@ class QuobyteShareDriver(driver.ExecuteMixin, driver.ShareDriver,): "add_allow_ip": access['access_to']} self.rpc.call('exportVolume', call_params) + def _build_share_export_string(self, rpc_result): + return '%(nfs_server_ip)s:%(qb_exp_path)s%(nfs_export_path)s' % { + "nfs_server_ip": rpc_result["nfs_server_ip"], + "qb_exp_path": self.configuration.quobyte_export_path, + "nfs_export_path": rpc_result["nfs_export_path"]} + def _deny_access(self, context, share, access, share_server=None): """Remove white-list ip from a share.""" if access['access_type'] != 'ip': diff --git a/manila/tests/share/drivers/quobyte/test_quobyte.py b/manila/tests/share/drivers/quobyte/test_quobyte.py index 1da79daaec..12350bfc88 100644 --- a/manila/tests/share/drivers/quobyte/test_quobyte.py +++ b/manila/tests/share/drivers/quobyte/test_quobyte.py @@ -96,7 +96,9 @@ class QuobyteShareDriverTestCase(test.TestCase): self.fake_conf = config.Configuration(None) self._driver = quobyte.QuobyteShareDriver(configuration=self.fake_conf) self._driver.rpc = mock.Mock() - self.share = fake_share.fake_share(share_proto='NFS') + self.share = fake_share.fake_share( + share_proto='NFS', + export_location='fake_location:/quobyte/fake_share') self.access = fake_share.fake_access() @mock.patch('manila.share.drivers.quobyte.jsonrpc.JsonRpc', mock.Mock()) @@ -138,8 +140,9 @@ class QuobyteShareDriverTestCase(test.TestCase): def test_create_share_existing_volume(self, qb_resize_mock): self._driver.rpc.call = mock.Mock(wraps=fake_rpc_handler) - self._driver.create_share(self._context, self.share) + result = self._driver.create_share(self._context, self.share) + self.assertEqual(self.share['export_location'], result) resolv_params = {'tenant_domain': 'fake_project_uuid', 'volume_name': 'fakename'} sett_params = {'tenant': {'tenant_id': 'fake_project_uuid'}} diff --git a/releasenotes/notes/bug-1773929-a5cb52c8417ec5fc.yaml b/releasenotes/notes/bug-1773929-a5cb52c8417ec5fc.yaml new file mode 100644 index 0000000000..4fd423b0ea --- /dev/null +++ b/releasenotes/notes/bug-1773929-a5cb52c8417ec5fc.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + The Quobyte driver now provides an option to adapt the export path + to the Quobyte NFS services PSEUDO path setting.