Skip to content

Commit

Permalink
Merge "Unity/VNX Driver: Rename driver options"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Jan 10, 2017
2 parents ba79870 + 0139152 commit 966b162
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 45 deletions.
20 changes: 4 additions & 16 deletions manila/share/drivers/dell_emc/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@
"""

from oslo_config import cfg
from oslo_log import log

from manila.share import driver
from manila.share.drivers.dell_emc import plugin_manager as manager

LOG = log.getLogger(__name__)

EMC_NAS_OPTS = [
cfg.StrOpt('emc_nas_login',
help='User name for the EMC server.'),
Expand All @@ -45,19 +42,8 @@
ignore_case=True,
choices=['isilon', 'vnx', 'unity'],
help='Share backend.'),
cfg.StrOpt('emc_nas_server_container',
help='Container of share servers.'),
cfg.ListOpt('emc_nas_pool_names',
deprecated_name='emc_nas_pool_name',
help='EMC pool names.'),
cfg.StrOpt('emc_nas_root_dir',
help='The root directory where shares will be located.'),
cfg.StrOpt('emc_nas_server_pool',
help='Pool to persist the meta-data of NAS server.'),
cfg.ListOpt('emc_interface_ports',
help='Comma separated list specifying the ports that can be '
'used for share server interfaces. Members of the list '
'can be Unix-style glob expressions.'),
help='The root directory where shares will be located.')
]

CONF = cfg.CONF
Expand All @@ -78,7 +64,9 @@ def __init__(self, *args, **kwargs):
self.backend_name = self.backend_name or 'EMC_NAS_Storage'
self.plugin_manager = manager.EMCPluginManager(
namespace='manila.share.drivers.dell_emc.plugins')
self.plugin = self.plugin_manager.load_plugin(self.backend_name, LOG)
self.plugin = self.plugin_manager.load_plugin(
self.backend_name,
configuration=self.configuration)
super(EMCShareDriver, self).__init__(
self.plugin.driver_handles_share_servers, *args, **kwargs)

Expand Down
4 changes: 2 additions & 2 deletions manila/share/drivers/dell_emc/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def __init__(self, namespace):

self.extension_manager = extension.ExtensionManager(namespace)

def load_plugin(self, name, logger=None):
def load_plugin(self, name, *args, **kwargs):
for ext in self.extension_manager.extensions:
if ext.name == name:
storage_conn = ext.plugin(logger)
storage_conn = ext.plugin(*args, **kwargs)
return storage_conn

return None
3 changes: 1 addition & 2 deletions manila/share/drivers/dell_emc/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
class StorageConnection(object):
"""Subclasses should implement storage backend specific functionality."""

def __init__(self, logger):
self.logger = logger
def __init__(self, *args, **kwargs):
# NOTE(vponomaryov): redefine 'driver_handles_share_servers' within
# plugin.
self.driver_handles_share_servers = None
Expand Down
37 changes: 30 additions & 7 deletions manila/share/drivers/dell_emc/plugins/unity/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# under the License.
"""Unity backend for the EMC Manila driver."""

from oslo_config import cfg
from oslo_log import log
from oslo_utils import excutils
from oslo_utils import importutils
Expand All @@ -38,6 +39,27 @@
LOG = log.getLogger(__name__)
SUPPORTED_NETWORK_TYPES = (None, 'flat', 'vlan')

UNITY_OPTS = [
cfg.StrOpt('unity_server_meta_pool',
deprecated_name='emc_nas_server_pool',
help='Pool to persist the meta-data of NAS server.'),
cfg.StrOpt('unity_server_container',
deprecated_name='emc_nas_server_container',
help='Storage processor to host the NAS server.'),
cfg.ListOpt('unity_share_data_pools',
deprecated_name='emc_nas_pool_names',
help='Comma separated list of pools that can be used to '
'persist share data.'),
cfg.ListOpt('unity_ethernet_ports',
deprecated_name='emc_interface_ports',
help='Comma separated list of ports that can be used for '
'share server interfaces. Members of the list '
'can be Unix-style glob expressions.')
]

CONF = cfg.CONF
CONF.register_opts(UNITY_OPTS)


@emc_utils.decorate_all_methods(emc_utils.log_enter_exit,
debug_only=True)
Expand All @@ -49,6 +71,9 @@ class UnityStorageConnection(driver.StorageConnection):
@emc_utils.log_enter_exit
def __init__(self, *args, **kwargs):
super(UnityStorageConnection, self).__init__(*args, **kwargs)
if 'configuration' in kwargs:
kwargs['configuration'].append_config_values(UNITY_OPTS)

self.client = None
self.pool_set = None
self.port_set = None
Expand All @@ -66,11 +91,10 @@ def connect(self, emc_share_driver, context):
storage_ip = config.emc_nas_server
username = config.emc_nas_login
password = config.emc_nas_password
sp_name = config.emc_nas_server_container
sp_name = config.unity_server_container
self.client = client.UnityClient(storage_ip, username, password)

pool_conf = config.safe_get(
'emc_nas_pool_names')
pool_conf = config.safe_get('unity_share_data_pools')
self.pool_set = self._get_managed_pools(pool_conf)

self.reserved_percentage = config.safe_get(
Expand All @@ -83,12 +107,11 @@ def connect(self, emc_share_driver, context):

self._config_sp(sp_name)

port_conf = config.safe_get(
'emc_interface_ports')
port_conf = config.safe_get('unity_ethernet_ports')
self.port_set = self._get_managed_ports(
port_conf, self.storage_processor)

pool_name = config.emc_nas_server_pool
pool_name = config.unity_server_meta_pool
self._config_pool(pool_name)

def check_for_setup_error(self):
Expand Down Expand Up @@ -489,7 +512,7 @@ def _get_managed_ports(self, port_conf, sp):
if not matched_ports:
msg = (_("All the specified storage ports to be managed "
"do not exist. Please check your configuration "
"emc_interface_ports in manila.conf. "
"unity_ethernet_ports in manila.conf. "
"The available ports in the backend are %s") %
",".join(real_ports))
raise exception.BadConfigurationException(reason=msg)
Expand Down
44 changes: 31 additions & 13 deletions manila/share/drivers/dell_emc/plugins/vnx/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import copy
import random

from oslo_config import cfg
from oslo_log import log
from oslo_utils import excutils
from oslo_utils import units
Expand All @@ -35,6 +36,24 @@

LOG = log.getLogger(__name__)

VNX_OPTS = [
cfg.StrOpt('vnx_server_container',
deprecated_name='emc_nas_server_container',
help='Data mover to host the NAS server.'),
cfg.ListOpt('vnx_share_data_pools',
deprecated_name='emc_nas_pool_names',
help='Comma separated list of pools that can be used to '
'persist share data.'),
cfg.ListOpt('vnx_ethernet_ports',
deprecated_name='emc_interface_ports',
help='Comma separated list of ports that can be used for '
'share server interfaces. Members of the list '
'can be Unix-style glob expressions.')
]

CONF = cfg.CONF
CONF.register_opts(VNX_OPTS)


@vnx_utils.decorate_all_methods(vnx_utils.log_enter_exit,
debug_only=True)
Expand All @@ -44,6 +63,9 @@ class VNXStorageConnection(driver.StorageConnection):
@vnx_utils.log_enter_exit
def __init__(self, *args, **kwargs):
super(VNXStorageConnection, self).__init__(*args, **kwargs)
if 'configuration' in kwargs:
kwargs['configuration'].append_config_values(VNX_OPTS)

self.mover_name = None
self.pools = None
self.manager = None
Expand Down Expand Up @@ -518,7 +540,7 @@ def _get_managed_storage_pools(self, pools):
if not matched_pools:
msg = (_("None of the specified storage pools to be managed "
"exist. Please check your configuration "
"emc_nas_pool_names in manila.conf. "
"vnx_share_data_pools in manila.conf. "
"The available pools in the backend are %s.") %
",".join(real_pools))
raise exception.InvalidParameterValue(err=msg)
Expand All @@ -532,22 +554,18 @@ def _get_managed_storage_pools(self, pools):

def connect(self, emc_share_driver, context):
"""Connect to VNX NAS server."""
self.mover_name = (
emc_share_driver.configuration.emc_nas_server_container)
config = emc_share_driver.configuration
config.append_config_values(VNX_OPTS)
self.mover_name = config.vnx_server_container

self.pool_conf = emc_share_driver.configuration.safe_get(
'emc_nas_pool_names')
self.pool_conf = config.safe_get('vnx_share_data_pools')

self.reserved_percentage = emc_share_driver.configuration.safe_get(
'reserved_share_percentage')
self.reserved_percentage = config.safe_get('reserved_share_percentage')
if self.reserved_percentage is None:
self.reserved_percentage = 0

configuration = emc_share_driver.configuration

self.manager = manager.StorageObjectManager(configuration)
self.port_conf = emc_share_driver.configuration.safe_get(
'emc_interface_ports')
self.manager = manager.StorageObjectManager(config)
self.port_conf = config.safe_get('vnx_ethernet_ports')

def get_managed_ports(self):
# Get the real ports(devices) list from the backend storage
Expand All @@ -563,7 +581,7 @@ def get_managed_ports(self):

if not matched_ports:
msg = (_("None of the specified network ports exist. "
"Please check your configuration emc_interface_ports "
"Please check your configuration vnx_ethernet_ports "
"in manila.conf. The available ports on the Data Mover "
"are %s.") %
",".join(real_ports))
Expand Down
5 changes: 3 additions & 2 deletions manila/tests/share/drivers/dell_emc/plugins/unity/res_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ class FakeEMCShareDriver(object):
def __init__(self):
self.configuration = conf.Configuration(None)
self.configuration.emc_share_backend = 'unity'
self.configuration.emc_nas_server_container = 'SPA'
self.configuration.unity_server_container = 'SPA'
self.configuration.emc_nas_server = '192.168.1.1'
self.configuration.emc_nas_login = 'fake_user'
self.configuration.emc_nas_password = 'fake_password'
self.configuration.share_backend_name = 'EMC_NAS_Storage'
self.configuration.emc_nas_server_pool = 'nas_server_pool'
self.configuration.vnx_server_meta_pool = 'nas_server_pool'
self.configuration.unity_server_meta_pool = 'nas_server_pool'
self.configuration.local_conf.max_over_subscription_ratio = 20


Expand Down
2 changes: 1 addition & 1 deletion manila/tests/share/drivers/dell_emc/plugins/vnx/fakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ def __init__(self):
self.configuration = conf.Configuration(None)
self.configuration.append_config_values = mock.Mock(return_value=0)
self.configuration.emc_share_backend = FakeData.emc_share_backend
self.configuration.emc_nas_server_container = FakeData.mover_name
self.configuration.vnx_server_container = FakeData.mover_name
self.configuration.emc_nas_server = FakeData.emc_nas_server
self.configuration.emc_nas_login = FakeData.emc_nas_login
self.configuration.emc_nas_password = FakeData.emc_nas_password
Expand Down
4 changes: 2 additions & 2 deletions manila/tests/share/drivers/dell_emc/test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@


class FakeConnection(base.StorageConnection):
def __init__(self, logger):
self.logger = logger
def __init__(self, *args, **kwargs):
pass

@property
def driver_handles_share_servers(self):
Expand Down
17 changes: 17 additions & 0 deletions releasenotes/notes/unity-vnx-rename-options-1656168dd4bdba70.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
upgrade:
- For Dell EMC Unity Manila driver, replaced
emc_nas_pool_names with unity_share_data_pools,
emc_nas_server_pool with unity_server_meta_pool,
emc_interface_ports with unity_ethernet_ports,
emc_nas_server_container with unity_server_container.
- For Dell EMC VNX Manila driver, replaced
emc_nas_pool_names with vnx_share_data_pools,
emc_interface_ports with vnx_ethernet_ports,
emc_nas_server_container with vnx_server_container.
deprecations:
- For Dell EMC Unity Manila driver, options emc_nas_pool_names,
emc_nas_server_pool, emc_interface_ports, emc_nas_server_container are
deprecated.
- For Dell EMC VNX Manila driver, options emc_nas_pool_names,
emc_interface_ports, emc_nas_server_container are deprecated.

0 comments on commit 966b162

Please sign in to comment.