[Unity] Driver supports the mode that does not create and destory share servers (DHSS=False)

Support 'driver_handles_share_servers = False' in manila.conf.
In such mode, need set unity_share_server in manila.conf, driver
will use this NAS server for share creation.

Change-Id: Iebc30d289fdb9f250e4951257313d630faa8bdf7
This commit is contained in:
dingd 2019-08-01 15:28:38 +08:00 committed by DingDong
parent 0ed8c74dc4
commit 8d26a34cd1
9 changed files with 346 additions and 78 deletions

View File

@ -121,21 +121,67 @@ for the Unity driver.
emc_nas_server = <management IP address of the Unity system>
emc_nas_login = <user with administrator privilege>
emc_nas_password = <password>
emc_nas_server_container = [SPA|SPB]
emc_nas_pool_names = <Comma separated pool names>
emc_interface_ports = <Comma separated ports list>
unity_server_meta_pool = <pool name>
unity_share_data_pools = <comma separated pool names>
unity_ethernet_ports = <comma separated ports list>
driver_handles_share_servers = True/False
unity_share_server = <name of NAS server in Unity system>
- `emc_share_backend` is the plugin name. Set it to `unity` for the Unity
driver.
- `emc_nas_server` is the management IP for Unity.
- `emc_nas_server_container` is the SP that will be used as share server.
- `emc_nas_pool_names` is the name of the pools to be used by this backend.
If no name is specified, all storage pools on the system will be managed.
Wild card character is supported.
Examples: pool_1, pool_*, *
- `emc_interface_ports` is the white list of the ports to be used for
connection. Wild card character is supported.
Examples: spa_eth1, spa_*, *
- `emc_share_backend`
The plugin name. Set it to `unity` for the Unity driver.
- `emc_nas_server`
The management IP for Unity.
- `unity_server_meta_pool`
The name of the pool to persist the meta-data of NAS server.
This option is required.
- `unity_share_data_pools`
Comma separated list specifying the name of the pools to be used
by this backend. Do not set this option if all storage pools
on the system can be used.
Wild card character is supported.
Examples:
.. code-block:: ini
# Only use pool_1
unity_share_data_pools = pool_1
# Only use pools whose name stars from pool_
unity_share_data_pools = pool_*
# Use all pools on Unity
unity_share_data_pools = *
- `unity_ethernet_ports`
Comma separated list specifying the ethernet ports of Unity system
that can be used for share. Do not set this option if all ethernet ports
can be used.
Wild card character is supported. Both the normal ethernet port and link
aggregation port can be used by Unity share driver.
Examples:
.. code-block:: ini
# Only use spa_eth1
unity_ethernet_ports = spa_eth1
# Use port whose name stars from spa_
unity_ethernet_ports = spa_*
# Use all Link Aggregation ports
unity_ethernet_ports = sp*_la_*
# Use all available ports
unity_ethernet_ports = *
- `driver_handles_share_servers`
Unity driver requires this option to be as `True` or `False`.
Need to set `unity_share_server` when the value is `False`.
- `unity_share_server`
One of NAS server names in Unity, it is used for share creation when
the driver is in `DHSS=False` mode.
Restart of :term:`manila-share` service is needed for the configuration changes to take
effect.
@ -149,22 +195,6 @@ into two parts:
1. The driver is able to manage share or snapshot in the Neutron IPv6 network.
2. The driver is able to connect Unity management interface using its IPv6 address.
Pre-Configurations for IPv6 support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following parameters need to be configured in `/etc/manila/manila.conf`
for the Unity driver:
network_plugin_ipv6_enabled = True
- `network_plugin_ipv6_enabled` indicates IPv6 is enabled.
If you want to connect Unity using IPv6 address, you should configure IPv6 address
by `/net/if/mgmt` uemcli command, `mgmtInterfaceSettings` RESTful api or the system
settings of Unity GUI for Unity and specify the address in `/etc/manila/manila.conf`:
emc_nas_server = <IPv6 address>
Snapshot support
----------------
@ -176,44 +206,6 @@ create snapshots on shares of this share type. The feature is divided into two p
1. The driver is able to create/delete snapshot of share.
2. The driver is able to create share from snapshot.
Pre-Configurations for Snapshot support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following extra specifications need to be configured with share type.
- snapshot_support = True
- create_share_from_snapshot_support = True
For new share type, these extra specifications can be set directly when creating share type:
.. code-block:: console
manila type-create --snapshot_support True --create_share_from_snapshot_support True ${share_type_name} True
Or you can update already existing share type with command:
.. code-block:: console
manila type-key ${share_type_name} set snapshot_support=True
manila type-key ${share_type_name} set create_share_from_snapshot_support=True
To snapshot a share and create share from the snapshot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Firstly, you need create a share from share type that has extra specifications(snapshot_support=True, create_share_from_snapshot_support=True).
Then snapshot the share with command:
.. code-block:: console
manila snapshot-create ${source_share_name} --name ${target_snapshot_name} --description " "
After creating the snapshot from previous step, you can create share from that snapshot.
Use command:
.. code-block:: console
manila create nfs 1 --name ${target_share_name} --metadata source=snapshot --description " " --snapshot-id ${source_snapshot_id}
Restrictions
------------

View File

@ -30,6 +30,10 @@ Requirements
- Thin Provisioning
- Fiber Channel (FC)
- Internet Small Computer System Interface (iSCSI)
Supported shared filesystems and operations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -96,6 +100,109 @@ change the above mtu size from Unity Unisphere:
The Unity driver will select the port where mtu is equal to the mtu
of share network during share server creation.
IPv6 support
------------
IPv6 support for Unity driver is introduced in Queens release. The feature is divided
into two parts:
#. The driver is able to manage share or snapshot in the Neutron IPv6 network.
#. The driver is able to connect Unity management interface using its IPv6 address.
Pre-Configurations for IPv6 support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following parameters need to be configured in `/etc/manila/manila.conf`
for the Unity driver:
network_plugin_ipv6_enabled = True
- `network_plugin_ipv6_enabled` indicates IPv6 is enabled.
If you want to connect Unity using IPv6 address, you should configure IPv6 address
by `/net/if/mgmt` uemcli command, `mgmtInterfaceSettings` RESTful api or the system
settings of Unity GUI for Unity and specify the address in `/etc/manila/manila.conf`:
emc_nas_server = <IPv6 address>
Supported share creation in mode that driver does not create and destroy share servers (DHSS=False)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To create a file share in this mode, you need to:
#. Create NAS server with network interface in Unity system.
#. Set 'driver_handles_share_servers=False' and 'unity_share_server' in ``/etc/manila/manila.conf``:
.. code-block:: ini
driver_handles_share_servers = False
unity_share_server = <name of NAS server in Unity system>
#. Specify the share type with driver_handles_share_servers = False extra specification:
.. code-block:: console
$ manila type-create <share_type_name> False
#. Create share.
.. code-block:: console
$ manila create <share_protocol> <size> --name <share_name> --share-type <share_type_name>
.. note::
Do not specify the share network in share creation command because no share servers will be created.
Driver will use the unity_share_server specified for share creation.
Snapshot support
----------------
In the Mitaka and Newton release of OpenStack, Snapshot support is enabled by default for a newly created share type.
Starting with the Ocata release, the snapshot_support extra spec must be set to True in order to allow snapshots for
a share type. If the 'snapshot_support' extra_spec is omitted or if it is set to False, users would not be able to
create snapshots on shares of this share type. The feature is divided into two parts:
1. The driver is able to create/delete snapshot of share.
2. The driver is able to create share from snapshot.
Pre-Configurations for Snapshot support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following extra specifications need to be configured with share type.
- snapshot_support = True
- create_share_from_snapshot_support = True
For new share type, these extra specifications can be set directly when creating share type:
.. code-block:: console
manila type-create --snapshot_support True --create_share_from_snapshot_support True ${share_type_name} True
Or you can update already existing share type with command:
.. code-block:: console
manila type-key ${share_type_name} set snapshot_support=True
manila type-key ${share_type_name} set create_share_from_snapshot_support=True
To snapshot a share and create share from the snapshot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Firstly, you need create a share from share type that has extra specifications(snapshot_support=True, create_share_from_snapshot_support=True).
Then snapshot the share with command:
.. code-block:: console
manila snapshot-create ${source_share_name} --name ${target_snapshot_name} --description " "
After creating the snapshot from previous step, you can create share from that snapshot.
Use command:
.. code-block:: console
manila create nfs 1 --name ${target_share_name} --metadata source=snapshot --description " " --snapshot-id ${source_snapshot_id}
Supported security services
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -164,7 +271,8 @@ for the Unity driver.
unity_server_meta_pool = <pool name>
unity_share_data_pools = <comma separated pool names>
unity_ethernet_ports = <comma separated ports list>
driver_handles_share_servers = True
driver_handles_share_servers = True/False
unity_share_server = <name of NAS server in Unity system>
- ``emc_share_backend``
The plugin name. Set it to `unity` for the Unity driver.
@ -227,8 +335,12 @@ for the Unity driver.
impact.
- ``driver_handles_share_servers``
Unity driver requires this option to be as ``True``.
Unity driver requires this option to be as ``True`` or ``False``.
Need to set ``unity_share_server`` when the value is ``False``.
- ``unity_share_server``
One of NAS server names in Unity, it is used for share creation when
the driver is in ``DHSS=False`` mode.
Restart of ``manila-share`` service is needed for the configuration
changes to take effect.

View File

@ -24,3 +24,5 @@
- (String) Pool to persist the meta-data of NAS server.
* - ``unity_share_data_pools`` = ``None``
- (List) Comma separated list of pools that can be used to persist share data.
* - ``unity_share_server`` = ``None``
- One of NAS server names in Unity, it is used for share creation when the driver is in ``DHSS=False`` mode..

View File

@ -37,7 +37,11 @@ from manila.share.drivers.dell_emc.plugins.unity import utils as unity_utils
from manila.share import utils as share_utils
from manila import utils
VERSION = "6.1.0"
"""Version history:
7.0.0 - Supports DHSS=False mode
"""
VERSION = "7.0.0"
LOG = log.getLogger(__name__)
SUPPORTED_NETWORK_TYPES = (None, 'flat', 'vlan')
@ -61,6 +65,10 @@ UNITY_OPTS = [
deprecated_reason='Unity driver supports nas server auto load '
'balance.',
help='Storage processor to host the NAS server. Obsolete.'),
cfg.StrOpt('unity_share_server',
help='NAS server used for creating share when driver '
'is in DHSS=False mode. It is required when '
'driver_handles_share_servers=False in manila.conf.'),
]
CONF = cfg.CONF
@ -86,12 +94,13 @@ class UnityStorageConnection(driver.StorageConnection):
self.reserved_percentage = None
self.max_over_subscription_ratio = None
self.port_ids_conf = None
self.unity_share_server = None
self.ipv6_implemented = True
self.revert_to_snap_support = True
self.shrink_share_support = True
# props from super class.
self.driver_handles_share_servers = True
self.driver_handles_share_servers = (True, False)
def connect(self, emc_share_driver, context):
"""Connect to Unity storage."""
@ -112,10 +121,25 @@ class UnityStorageConnection(driver.StorageConnection):
self.max_over_subscription_ratio = config.safe_get(
'max_over_subscription_ratio')
self.port_ids_conf = config.safe_get('unity_ethernet_ports')
self.unity_share_server = config.safe_get('unity_share_server')
self.driver_handles_share_servers = config.safe_get(
'driver_handles_share_servers')
if (not self.driver_handles_share_servers) and (
not self.unity_share_server):
msg = ("Make sure there is NAS server name "
"configured for share creation when driver "
"is in DHSS=False mode.")
raise exception.BadConfigurationException(reason=msg)
self.validate_port_configuration(self.port_ids_conf)
pool_name = config.unity_server_meta_pool
self._config_pool(pool_name)
def get_server_name(self, share_server=None):
if not self.driver_handles_share_servers:
return self.unity_share_server
else:
return self._get_server_name(share_server)
def validate_port_configuration(self, port_ids_conf):
"""Initializes the SP and ports based on the port option."""
@ -165,9 +189,8 @@ class UnityStorageConnection(driver.StorageConnection):
# Get pool name from share host field
pool_name = self._get_pool_name_from_host(share['host'])
# Get share server name from share server
server_name = self._get_server_name(share_server)
# Get share server name from share server or manila.conf.
server_name = self.get_server_name(share_server)
pool = self.client.get_pool(pool_name)
try:
nas_server = self.client.get_nas_server(server_name)
@ -207,7 +230,7 @@ class UnityStorageConnection(driver.StorageConnection):
self._validate_share_protocol(share_proto)
# Get share server name from share server
server_name = self._get_server_name(share_server)
server_name = self.get_server_name(share_server)
try:
nas_server = self.client.get_nas_server(server_name)

View File

@ -188,6 +188,42 @@ nfs_share:
export_locations: []
is_public: False
dhss_false_cifs_share:
_type: 'share'
_properties: &dhss_false_cifs_share_prop
share_id: '708e753c-aacb-411f-9c8a-8b8175da4e73'
availability_zone_id: 'de628fb6-1c99-41f6-a06a-adb61ff693b5'
share_network_id: '232d8218-2743-41d1-832b-4194626e691e'
share_server_id: 'test-dhss-false-427f-b4de-0ad83el5j8'
id: '716100cc-e0b4-416b-ac27-d38dd019330d'
size: 1
user_id: '19bbda71b578471a93363653dcb4c61d'
status: 'creating'
share_type_id: '57679eab-3e67-4052-b180-62b609670e93'
host: 'openstack@VNX#Pool_2'
display_name: 'cifs_share'
share_proto: 'CIFS'
export_locations: []
is_public: False
dhss_false_nfs_share:
_type: 'share'
_properties: &dhss_false_nfs_share_prop
share_id: '12eb3777-7008-4721-8243-422507db8f9d'
availability_zone_id: 'de628fb6-1c99-41f6-a06a-adb61ff693b5'
share_network_id: '232d8218-2743-41d1-832b-4194626e691e'
share_server_id: 'test-dhss-false-427f-b4de-0ad83el5j8'
id: 'cb532599-8dc6-4c3e-bb21-74ea54be566c'
size: 1
user_id: '19bbda71b578471a93363653dcb4c61d'
status: 'creating'
share_type_id: '57679eab-3e67-4052-b180-62b609670e93'
host: 'openstack@VNX#Pool_2'
display_name: 'nfs_share'
share_proto: 'NFS'
export_locations: []
is_public: False
shrink_cifs_share:
_type: 'share'
_properties: &shrink_cifs_share_prop

View File

@ -190,6 +190,9 @@ unity_base: &unity_base
test_connect: &test_connect
unity: *unity_base
test_dhss_false_connect: &test_dhss_false_connect
unity: *unity_base
test_connect__invalid_sp_configuration:
unity:
_methods:
@ -247,6 +250,55 @@ test_create_cifs_share:
_side_effect: [*pool__test_create_cifs_share]
get_nas_server: *nas_server
test_dhss_false_create_nfs_share:
nfs_share: &nfs_share__test_dhss_false_create_nfs_share
_properties:
<<: *nfs_share_base_prop
name: 'cb532599-8dc6-4c3e-bb21-74ea54be566c'
pool: &pool__test_dhss_false_create_nfs_share
_properties:
<<: *pool_base_prop
name: 'Pool_2'
_methods:
create_nfs_share: None
unity:
_methods:
<<: *unity_base_method
get_pool:
_side_effect: [*pool__test_dhss_false_create_nfs_share]
get_nas_server: *nas_server
test_dhss_false_create_cifs_share:
cifs_share: &cifs_share__test_dhss_false_create_cifs_share
_properties:
<<: *cifs_share_base_prop
name: '716100cc-e0b4-416b-ac27-d38dd019330d'
_methods:
enable_ace:
filesystem: &filesystem__test_dhss_false_create_cifs_share
_properties: &filesystem_prop__test_dhss_false_create_cifs_share
<<: *filesystem_base_prop
name: '716100cc-e0b4-416b-ac27-d38dd4587340'
_methods:
create_cifs_share: *cifs_share__test_dhss_false_create_cifs_share
pool: &pool__test_dhss_false_create_cifs_share
_properties:
<<: *pool_base_prop
name: 'Pool_2'
_methods:
create_filesystem: *filesystem__test_dhss_false_create_cifs_share
unity:
_methods:
<<: *unity_base_method
get_pool:
_side_effect: [*pool__test_dhss_false_create_cifs_share]
get_nas_server: *nas_server
test_create_share_with_invalid_share_server:
pool: &pool__test_create_share_with_invalid_share_server
_properties:

View File

@ -14,6 +14,7 @@
# under the License.
import mock
from oslo_config import cfg
from oslo_log import log
from manila.share import configuration as conf
@ -34,6 +35,7 @@ SYMBOL_PROPERTIES = '_properties'
SYMBOL_METHODS = '_methods'
SYMBOL_SIDE_EFFECT = '_side_effect'
SYMBOL_RAISE = '_raise'
CONF = cfg.CONF
def _has_side_effect(node):
@ -84,7 +86,9 @@ def fake_access(**kwargs):
class FakeEMCShareDriver(object):
def __init__(self):
def __init__(self, dhss=None):
if dhss in (True, False):
CONF.set_default('driver_handles_share_servers', dhss)
self.configuration = conf.Configuration(None)
self.configuration.emc_share_backend = 'unity'
self.configuration.emc_nas_server = '192.168.1.1'
@ -258,6 +262,7 @@ unity_res = StorageResourceMock('mocked_unity.yaml')
STORAGE_RES_MAPPING = {
'TestClient': unity_res,
'TestConnection': unity_res,
'TestConnectionDHSSFalse': unity_res,
}

View File

@ -36,7 +36,7 @@ class TestConnection(test.TestCase):
@res_mock.patch_connection_init
def test_connect(self, connection):
connection.connect(res_mock.FakeEMCShareDriver(), None)
connection.connect(res_mock.FakeEMCShareDriver(dhss=True), None)
@res_mock.patch_connection
def test_connect__invalid_pool_configuration(self, connection):
@ -692,3 +692,45 @@ class TestConnection(test.TestCase):
connection.revert_to_snapshot(context, snapshot, share_access_rules,
snapshot_access_rules)
@res_mock.patch_connection_init
def test_dhss_false_connect_without_nas_server(self, connection):
self.assertRaises(exception.BadConfigurationException,
connection.connect,
res_mock.FakeEMCShareDriver(dhss=False), None)
@res_mock.mock_manila_input
@res_mock.patch_connection
def test_dhss_false_create_nfs_share(self, connection, mocked_input):
connection.driver_handles_share_servers = False
connection.unity_share_server = 'test-dhss-false-427f-b4de-0ad83el5j8'
share = mocked_input['dhss_false_nfs_share']
share_server = mocked_input['share_server']
location = connection.create_share(None, share, share_server)
exp_location = [
{'path': 'fake_ip_addr_1:/cb532599-8dc6-4c3e-bb21-74ea54be566c'},
{'path': 'fake_ip_addr_2:/cb532599-8dc6-4c3e-bb21-74ea54be566c'},
]
exp_location = sorted(exp_location, key=lambda x: sorted(x['path']))
location = sorted(location, key=lambda x: sorted(x['path']))
self.assertEqual(exp_location, location)
@res_mock.mock_manila_input
@res_mock.patch_connection
def test_dhss_false_create_cifs_share(self, connection, mocked_input):
connection.driver_handles_share_servers = False
connection.unity_share_server = 'test-dhss-false-427f-b4de-0ad83el5j8'
share = mocked_input['dhss_false_cifs_share']
share_server = mocked_input['share_server']
location = connection.create_share(None, share, share_server)
exp_location = [
{'path': r'\\fake_ip_addr_1\716100cc-e0b4-416b-ac27-d38dd019330d'},
{'path': r'\\fake_ip_addr_2\716100cc-e0b4-416b-ac27-d38dd019330d'},
]
exp_location = sorted(exp_location, key=lambda x: sorted(x['path']))
location = sorted(location, key=lambda x: sorted(x['path']))
self.assertEqual(exp_location, location)

View File

@ -0,0 +1,4 @@
---
features:
- Dell EMC Unity Manila driver now supports the mode in which it does
not itself create and destroy share servers (DHSS=False).