Merge "[Unity] Implements default filter function"

This commit is contained in:
Zuul 2020-05-20 20:21:50 +00:00 committed by Gerrit Code Review
commit 3fe0b8e835
7 changed files with 70 additions and 1 deletions

View File

@ -135,6 +135,7 @@ for the Unity driver.
unity_ethernet_ports = <comma separated ports list> unity_ethernet_ports = <comma separated ports list>
driver_handles_share_servers = True/False driver_handles_share_servers = True/False
unity_share_server = <name of NAS server in Unity system> unity_share_server = <name of NAS server in Unity system>
report_default_filter_function = True/False
- `emc_share_backend` - `emc_share_backend`
The plugin name. Set it to `unity` for the Unity driver. The plugin name. Set it to `unity` for the Unity driver.
@ -192,6 +193,13 @@ for the Unity driver.
One of NAS server names in Unity, it is used for share creation when One of NAS server names in Unity, it is used for share creation when
the driver is in `DHSS=False` mode. the driver is in `DHSS=False` mode.
- `report_default_filter_function`
Whether or not report default filter function. Default value is False.
However, this value will be changed to True in a future release to ensure
compliance with design expectations in Manila. So we recommend always
setting this option in your deployment to True or False per your desired
behavior.
Restart of :term:`manila-share` service is needed for the configuration Restart of :term:`manila-share` service is needed for the configuration
changes to take effect. changes to take effect.
@ -444,6 +452,22 @@ balanced ports per storage processor. For example:
# Use eth2 from both SPs # Use eth2 from both SPs
unity_ethernet_ports = spa_eth2, spb_eth2 unity_ethernet_ports = spa_eth2, spb_eth2
Default filter function
-----------------------
Unity does not support the file system creation with size smaller than 3GB, if
the size of share user create is smaller than 3GB, Unity driver will supplement
the size to 3GB in Unity.
Unity driver implemented the get_default_filter_function API to report the
default filter function, if the share size is smaller than 3GB, Manila will
not schedule the share creation to Unity backend.
Unity driver provides an option ``report_default_filter_function`` to disable
or enable the filter function reporting, the default value is disabled.
Restrictions Restrictions
------------ ------------
@ -483,6 +507,7 @@ Following driver features are implemented in the plugin.
parameters. parameters.
* teardown_server: Tear down the share server. * teardown_server: Tear down the share server.
* revert_to_snapshot: Revert a share to a snapshot. * revert_to_snapshot: Revert a share to a snapshot.
* get_default_filter_function: Report a default filter function.
Driver options Driver options

View File

@ -308,3 +308,8 @@ class EMCShareDriver(driver.ShareDriver):
share_server) share_server)
else: else:
raise NotImplementedError() raise NotImplementedError()
def get_default_filter_function(self):
if hasattr(self.plugin, 'get_default_filter_function'):
return self.plugin.get_default_filter_function()
return None

View File

@ -42,9 +42,10 @@ from manila import utils
7.0.1 - Fix parsing management IPv6 address 7.0.1 - Fix parsing management IPv6 address
7.0.2 - Bugfix: failed to delete CIFS share if wrong access was set 7.0.2 - Bugfix: failed to delete CIFS share if wrong access was set
8.0.0 - Supports manage/unmanage share server/share/snapshot 8.0.0 - Supports manage/unmanage share server/share/snapshot
9.0.0 - Implements default filter function
""" """
VERSION = "8.0.0" VERSION = "9.0.0"
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
SUPPORTED_NETWORK_TYPES = (None, 'flat', 'vlan') SUPPORTED_NETWORK_TYPES = (None, 'flat', 'vlan')
@ -72,6 +73,9 @@ UNITY_OPTS = [
help='NAS server used for creating share when driver ' help='NAS server used for creating share when driver '
'is in DHSS=False mode. It is required when ' 'is in DHSS=False mode. It is required when '
'driver_handles_share_servers=False in manila.conf.'), 'driver_handles_share_servers=False in manila.conf.'),
cfg.StrOpt('report_default_filter_function',
default=False,
help='Whether or not report default filter function.'),
] ]
CONF = cfg.CONF CONF = cfg.CONF
@ -143,6 +147,8 @@ class UnityStorageConnection(driver.StorageConnection):
self.validate_port_configuration(self.port_ids_conf) self.validate_port_configuration(self.port_ids_conf)
pool_name = config.unity_server_meta_pool pool_name = config.unity_server_meta_pool
self._config_pool(pool_name) self._config_pool(pool_name)
self.report_default_filter_function = config.safe_get(
'report_default_filter_function')
def get_server_name(self, share_server=None): def get_server_name(self, share_server=None):
if not self.driver_handles_share_servers: if not self.driver_handles_share_servers:
@ -894,3 +900,8 @@ class UnityStorageConnection(driver.StorageConnection):
"""Reverts a share (in place) to the specified snapshot.""" """Reverts a share (in place) to the specified snapshot."""
snapshot_id = unity_utils.get_snapshot_id(snapshot) snapshot_id = unity_utils.get_snapshot_id(snapshot)
return self.client.restore_snapshot(snapshot_id) return self.client.restore_snapshot(snapshot_id)
def get_default_filter_function(self):
if self.report_default_filter_function:
return "share.size >= 3"
return None

View File

@ -354,6 +354,7 @@ def do_connection_connect(conn, res):
conn.port_set = set(['spa_eth1', 'spa_eth2']) conn.port_set = set(['spa_eth1', 'spa_eth2'])
conn.nas_server_pool = StorageObjectMock(res['nas_server_pool']) conn.nas_server_pool = StorageObjectMock(res['nas_server_pool'])
conn.storage_processor = StorageObjectMock(res['sp_a']) conn.storage_processor = StorageObjectMock(res['sp_a'])
conn.report_default_filter_function = False
def patch_connection(func): def patch_connection(func):

View File

@ -882,3 +882,20 @@ class TestConnection(test.TestCase):
self.assertRaises(exception.ManageInvalidShare, self.assertRaises(exception.ManageInvalidShare,
connection.manage_existing_with_server, connection.manage_existing_with_server,
share, driver_options, share_server) share, driver_options, share_server)
@res_mock.mock_manila_input
@res_mock.patch_connection
def test_get_default_filter_function_disable_report(self, connection,
mocked_input):
expected = None
actual = connection.get_default_filter_function()
self.assertEqual(expected, actual)
@res_mock.mock_manila_input
@res_mock.patch_connection
def test_get_default_filter_function_enable_report(self, connection,
mocked_input):
expected = "share.size >= 3"
connection.report_default_filter_function = True
actual = connection.get_default_filter_function()
self.assertEqual(expected, actual)

View File

@ -116,6 +116,7 @@ class EMCShareFrameworkTestCase(test.TestCase):
def test_update_share_stats(self): def test_update_share_stats(self):
data = {} data = {}
self.driver.plugin = mock.Mock() self.driver.plugin = mock.Mock()
self.driver.plugin.get_default_filter_function.return_value = None
self.driver._update_share_stats() self.driver._update_share_stats()
data["share_backend_name"] = FAKE_BACKEND data["share_backend_name"] = FAKE_BACKEND
data["driver_handles_share_servers"] = True data["driver_handles_share_servers"] = True
@ -203,3 +204,8 @@ class EMCShareFrameworkTestCase(test.TestCase):
self.driver.unmanage_snapshot(snapshot) self.driver.unmanage_snapshot(snapshot)
self.driver.unmanage_snapshot_with_server(snapshot, share_server) self.driver.unmanage_snapshot_with_server(snapshot, share_server)
self.driver.unmanage_server(server_details) self.driver.unmanage_server(server_details)
def test_get_default_filter_function(self):
expected = None
actual = self.driver.get_default_filter_function()
self.assertEqual(expected, actual)

View File

@ -0,0 +1,4 @@
---
features:
- |
Dell EMC Unity: Default filter function support for 3GB share size.