Rename and move HNAS driver

Renamed HDS mentions on HNAS driver to Hitachi and moved the driver to
its own folder.

DocImpact
Change-Id: I03318a6e143e40b6f9186b58d47ef0618a6d152d
Implements: blueprint hnas-rename
This commit is contained in:
tpsilva 2016-08-16 13:22:05 -03:00
parent 04d8ed79a1
commit c314c3f400
9 changed files with 120 additions and 85 deletions

View File

@ -62,7 +62,7 @@ import manila.share.drivers.glusterfs.layout
import manila.share.drivers.glusterfs.layout_directory
import manila.share.drivers.glusterfs.layout_volume
import manila.share.drivers.hdfs.hdfs_native
import manila.share.drivers.hitachi.hds_hnas
import manila.share.drivers.hitachi.hnas.driver
import manila.share.drivers.hitachi.hsp.driver
import manila.share.drivers.hpe.hpe_3par_driver
import manila.share.drivers.huawei.huawei_nas
@ -131,7 +131,7 @@ _global_opt_lists = [
glusterfs_directory_mapped_opts,
manila.share.drivers.glusterfs.layout_volume.glusterfs_volume_mapped_opts,
manila.share.drivers.hdfs.hdfs_native.hdfs_native_share_opts,
manila.share.drivers.hitachi.hds_hnas.hds_hnas_opts,
manila.share.drivers.hitachi.hnas.driver.hitachi_hnas_opts,
manila.share.drivers.hitachi.hsp.driver.hitachi_hsp_opts,
manila.share.drivers.hpe.hpe_3par_driver.HPE3PAR_OPTS,
manila.share.drivers.huawei.huawei_nas.huawei_opts,

View File

@ -30,38 +30,49 @@ from manila.share import driver
LOG = log.getLogger(__name__)
hds_hnas_opts = [
cfg.StrOpt('hds_hnas_ip',
hitachi_hnas_opts = [
cfg.StrOpt('hitachi_hnas_ip',
deprecated_name='hds_hnas_ip',
help="HNAS management interface IP for communication "
"between Manila controller and HNAS."),
cfg.StrOpt('hds_hnas_user',
cfg.StrOpt('hitachi_hnas_user',
deprecated_name='hds_hnas_user',
help="HNAS username Base64 String in order to perform tasks "
"such as create file-systems and network interfaces."),
cfg.StrOpt('hds_hnas_password',
cfg.StrOpt('hitachi_hnas_password',
deprecated_name='hds_hnas_password',
secret=True,
help="HNAS user password. Required only if private key is not "
"provided."),
cfg.IntOpt('hds_hnas_evs_id',
cfg.IntOpt('hitachi_hnas_evs_id',
deprecated_name='hds_hnas_evs_id',
help="Specify which EVS this backend is assigned to."),
cfg.StrOpt('hds_hnas_evs_ip',
cfg.StrOpt('hitachi_hnas_evs_ip',
deprecated_name='hds_hnas_evs_ip',
help="Specify IP for mounting shares."),
cfg.StrOpt('hds_hnas_file_system_name',
cfg.StrOpt('hitachi_hnas_file_system_name',
deprecated_name='hds_hnas_file_system_name',
help="Specify file-system name for creating shares."),
cfg.StrOpt('hds_hnas_ssh_private_key',
cfg.StrOpt('hitachi_hnas_ssh_private_key',
deprecated_name='hds_hnas_ssh_private_key',
secret=True,
help="RSA/DSA private key value used to connect into HNAS. "
"Required only if password is not provided."),
cfg.StrOpt('hds_hnas_cluster_admin_ip0',
cfg.StrOpt('hitachi_hnas_cluster_admin_ip0',
deprecated_name='hds_hnas_cluster_admin_ip0',
help="The IP of the clusters admin node. Only set in HNAS "
"multinode clusters."),
cfg.IntOpt('hds_hnas_stalled_job_timeout',
cfg.IntOpt('hitachi_hnas_stalled_job_timeout',
deprecated_name='hds_hnas_stalled_job_timeout',
default=30,
help="The time (in seconds) to wait for stalled HNAS jobs "
"before aborting."),
cfg.StrOpt('hds_hnas_driver_helper',
default='manila.share.drivers.hitachi.ssh.HNASSSHBackend',
cfg.StrOpt('hitachi_hnas_driver_helper',
deprecated_name='hds_hnas_driver_helper',
default='manila.share.drivers.hitachi.hnas.ssh.HNASSSHBackend',
help="Python class to be used for driver helper."),
cfg.BoolOpt('hds_hnas_allow_cifs_snapshot_while_mounted',
cfg.BoolOpt('hitachi_hnas_allow_cifs_snapshot_while_mounted',
deprecated_name='hds_hnas_allow_cifs_snapshot_while_mounted',
default=False,
help="By default, CIFS snapshots are not allowed to be taken "
"when the share has clients connected because consistent "
@ -71,69 +82,71 @@ hds_hnas_opts = [
]
CONF = cfg.CONF
CONF.register_opts(hds_hnas_opts)
CONF.register_opts(hitachi_hnas_opts)
class HDSHNASDriver(driver.ShareDriver):
class HitachiHNASDriver(driver.ShareDriver):
"""Manila HNAS Driver implementation.
1.0.0 - Initial Version.
2.0.0 - Refactoring, bugfixes, implemented Share Shrink and Update Access.
3.0.0 - Implemented support for CIFS protocol.
3.0.0 - New driver location, implemented support for CIFS protocol.
"""
def __init__(self, *args, **kwargs):
"""Do initialization."""
LOG.debug("Invoking base constructor for Manila HDS HNAS Driver.")
super(HDSHNASDriver, self).__init__(False, *args, **kwargs)
LOG.debug("Invoking base constructor for Manila Hitachi HNAS Driver.")
super(HitachiHNASDriver, self).__init__(False, *args, **kwargs)
LOG.debug("Setting up attributes for Manila HDS HNAS Driver.")
self.configuration.append_config_values(hds_hnas_opts)
LOG.debug("Setting up attributes for Manila Hitachi HNAS Driver.")
self.configuration.append_config_values(hitachi_hnas_opts)
LOG.debug("Reading config parameters for Manila HDS HNAS Driver.")
LOG.debug("Reading config parameters for Manila Hitachi HNAS Driver.")
self.backend_name = self.configuration.safe_get('share_backend_name')
hnas_helper = self.configuration.safe_get('hds_hnas_driver_helper')
hnas_ip = self.configuration.safe_get('hds_hnas_ip')
hnas_username = self.configuration.safe_get('hds_hnas_user')
hnas_password = self.configuration.safe_get('hds_hnas_password')
hnas_evs_id = self.configuration.safe_get('hds_hnas_evs_id')
self.hnas_evs_ip = self.configuration.safe_get('hds_hnas_evs_ip')
self.fs_name = self.configuration.safe_get('hds_hnas_file_system_name')
hnas_helper = self.configuration.safe_get('hitachi_hnas_driver_helper')
hnas_ip = self.configuration.safe_get('hitachi_hnas_ip')
hnas_username = self.configuration.safe_get('hitachi_hnas_user')
hnas_password = self.configuration.safe_get('hitachi_hnas_password')
hnas_evs_id = self.configuration.safe_get('hitachi_hnas_evs_id')
self.hnas_evs_ip = self.configuration.safe_get('hitachi_hnas_evs_ip')
self.fs_name = self.configuration.safe_get(
'hitachi_hnas_file_system_name')
self.cifs_snapshot = self.configuration.safe_get(
'hds_hnas_allow_cifs_snapshot_while_mounted')
'hitachi_hnas_allow_cifs_snapshot_while_mounted')
ssh_private_key = self.configuration.safe_get(
'hds_hnas_ssh_private_key')
'hitachi_hnas_ssh_private_key')
cluster_admin_ip0 = self.configuration.safe_get(
'hds_hnas_cluster_admin_ip0')
'hitachi_hnas_cluster_admin_ip0')
self.private_storage = kwargs.get('private_storage')
job_timeout = self.configuration.safe_get(
'hds_hnas_stalled_job_timeout')
'hitachi_hnas_stalled_job_timeout')
if hnas_helper is None:
msg = _("The config parameter hds_hnas_driver_helper is not set.")
msg = _("The config parameter hitachi_hnas_driver_helper is not "
"set.")
raise exception.InvalidParameterValue(err=msg)
if hnas_evs_id is None:
msg = _("The config parameter hds_hnas_evs_id is not set.")
msg = _("The config parameter hitachi_hnas_evs_id is not set.")
raise exception.InvalidParameterValue(err=msg)
if self.hnas_evs_ip is None:
msg = _("The config parameter hds_hnas_evs_ip is not set.")
msg = _("The config parameter hitachi_hnas_evs_ip is not set.")
raise exception.InvalidParameterValue(err=msg)
if hnas_ip is None:
msg = _("The config parameter hds_hnas_ip is not set.")
msg = _("The config parameter hitachi_hnas_ip is not set.")
raise exception.InvalidParameterValue(err=msg)
if hnas_username is None:
msg = _("The config parameter hds_hnas_user is not set.")
msg = _("The config parameter hitachi_hnas_user is not set.")
raise exception.InvalidParameterValue(err=msg)
if hnas_password is None and ssh_private_key is None:
msg = _("Credentials configuration parameters missing: "
"you need to set hds_hnas_password or "
"hds_hnas_ssh_private_key.")
"you need to set hitachi_hnas_password or "
"hitachi_hnas_ssh_private_key.")
raise exception.InvalidParameterValue(err=msg)
LOG.debug("Initializing HNAS Layer.")
@ -416,7 +429,7 @@ class HDSHNASDriver(driver.ShareDriver):
def _update_share_stats(self, data=None):
"""Updates the Capability of Backend."""
LOG.debug("Updating Backend Capability Information - HDS HNAS.")
LOG.debug("Updating Backend Capability Information - Hitachi HNAS.")
self._check_fs_mounted()
@ -427,7 +440,7 @@ class HDSHNASDriver(driver.ShareDriver):
data = {
'share_backend_name': self.backend_name,
'driver_handles_share_servers': self.driver_handles_share_servers,
'vendor_name': 'HDS',
'vendor_name': 'Hitachi',
'driver_version': '3.0.0',
'storage_protocol': 'NFS_CIFS',
'total_capacity_gb': total_space,
@ -441,7 +454,7 @@ class HDSHNASDriver(driver.ShareDriver):
LOG.info(_LI("HNAS Capabilities: %(data)s."),
{'data': six.text_type(data)})
super(HDSHNASDriver, self)._update_share_stats(data)
super(HitachiHNASDriver, self)._update_share_stats(data)
def manage_existing(self, share, driver_options):
"""Manages a share that exists on backend.
@ -738,8 +751,8 @@ class HDSHNASDriver(driver.ShareDriver):
if (self.hnas.is_cifs_in_use(hnas_share_id) and
not self.cifs_snapshot):
msg = _("CIFS snapshot when share is mounted is disabled. "
"Set hds_hnas_allow_cifs_snapshot_while_mounted to "
"True or unmount the share to take a snapshot.")
"Set hitachi_hnas_allow_cifs_snapshot_while_mounted to"
" True or unmount the share to take a snapshot.")
raise exception.ShareBackendException(msg=msg)
src_path = os.path.join('/shares', hnas_share_id)

View File

@ -480,7 +480,7 @@ class HNASSSHBackend(object):
LOG.error(_LE("Error running SSH command."))
raise
@mutils.synchronized("hds_hnas_select_fs", external=True)
@mutils.synchronized("hitachi_hnas_select_fs", external=True)
def _locked_selectfs(self, op, path):
if op == 'create':
command = ['selectfs', self.fs_name, '\n',

View File

@ -112,6 +112,8 @@ MAPPING = {
'manila.share.drivers.netapp.common.NetAppDriver',
'manila.share.drivers.hp.hp_3par_driver.HP3ParShareDriver':
'manila.share.drivers.hpe.hpe_3par_driver.HPE3ParShareDriver',
'manila.share.drivers.hitachi.hds_hnas.HDSHNASDriver':
'manila.share.drivers.hitachi.hnas.driver.HitachiHNASDriver',
'manila.share.drivers.glusterfs_native.GlusterfsNativeShareDriver':
'manila.share.drivers.glusterfs.glusterfs_native.'
'GlusterfsNativeShareDriver',

View File

@ -20,8 +20,8 @@ from oslo_config import cfg
from manila import exception
import manila.share.configuration
import manila.share.driver
from manila.share.drivers.hitachi import hds_hnas
from manila.share.drivers.hitachi import ssh
from manila.share.drivers.hitachi.hnas import driver
from manila.share.drivers.hitachi.hnas import ssh
from manila import test
CONF = cfg.CONF
@ -139,22 +139,22 @@ invalid_protocol_msg = ("Share backend error: Only NFS or CIFS protocol are "
@ddt.ddt
class HDSHNASTestCase(test.TestCase):
class HitachiHNASTestCase(test.TestCase):
def setUp(self):
super(HDSHNASTestCase, self).setUp()
super(HitachiHNASTestCase, self).setUp()
CONF.set_default('driver_handles_share_servers', False)
CONF.hds_hnas_evs_id = '2'
CONF.hds_hnas_evs_ip = '172.24.44.10'
CONF.hds_hnas_ip = '172.24.44.1'
CONF.hds_hnas_ip_port = 'hds_hnas_ip_port'
CONF.hds_hnas_user = 'hds_hnas_user'
CONF.hds_hnas_password = 'hds_hnas_password'
CONF.hds_hnas_file_system_name = 'file_system'
CONF.hds_hnas_ssh_private_key = 'private_key'
CONF.hds_hnas_cluster_admin_ip0 = None
CONF.hds_hnas_stalled_job_timeout = 10
CONF.hds_hnas_driver_helper = ('manila.share.drivers.hitachi.ssh.'
'HNASSSHBackend')
CONF.hitachi_hnas_evs_id = '2'
CONF.hitachi_hnas_evs_ip = '172.24.44.10'
CONF.hitachi_hnas_ip = '172.24.44.1'
CONF.hitachi_hnas_ip_port = 'hitachi_hnas_ip_port'
CONF.hitachi_hnas_user = 'hitachi_hnas_user'
CONF.hitachi_hnas_password = 'hitachi_hnas_password'
CONF.hitachi_hnas_file_system_name = 'file_system'
CONF.hitachi_hnas_ssh_private_key = 'private_key'
CONF.hitachi_hnas_cluster_admin_ip0 = None
CONF.hitachi_hnas_stalled_job_timeout = 10
CONF.hitachi_hnas_driver_helper = ('manila.share.drivers.hitachi.hnas.'
'ssh.HNASSSHBackend')
self.fake_conf = manila.share.configuration.Configuration(None)
self.fake_private_storage = mock.Mock()
@ -163,11 +163,11 @@ class HDSHNASTestCase(test.TestCase):
self.mock_object(self.fake_private_storage, 'delete',
mock.Mock(return_value=None))
self._driver = hds_hnas.HDSHNASDriver(
self._driver = driver.HitachiHNASDriver(
private_storage=self.fake_private_storage,
configuration=self.fake_conf)
self._driver.backend_name = "hnas"
self.mock_log = self.mock_object(hds_hnas, 'LOG')
self.mock_log = self.mock_object(driver, 'LOG')
# mocking common backend calls
self.mock_object(ssh.HNASSSHBackend, "check_fs_mounted", mock.Mock(
@ -177,8 +177,8 @@ class HDSHNASTestCase(test.TestCase):
self.mock_object(ssh.HNASSSHBackend, "check_cifs", mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "check_export", mock.Mock())
@ddt.data('hds_hnas_driver_helper', 'hds_hnas_evs_id', 'hds_hnas_evs_ip',
'hds_hnas_ip', 'hds_hnas_user')
@ddt.data('hitachi_hnas_driver_helper', 'hitachi_hnas_evs_id',
'hitachi_hnas_evs_ip', 'hitachi_hnas_ip', 'hitachi_hnas_user')
def test_init_invalid_conf_parameters(self, attr_name):
self.mock_object(manila.share.driver.ShareDriver, '__init__')
setattr(CONF, attr_name, None)
@ -189,8 +189,8 @@ class HDSHNASTestCase(test.TestCase):
def test_init_invalid_credentials(self):
self.mock_object(manila.share.driver.ShareDriver,
'__init__')
CONF.hds_hnas_password = None
CONF.hds_hnas_ssh_private_key = None
CONF.hitachi_hnas_password = None
CONF.hitachi_hnas_ssh_private_key = None
self.assertRaises(exception.InvalidParameterValue,
self._driver.__init__)
@ -336,7 +336,7 @@ class HDSHNASTestCase(test.TestCase):
@ddt.data(share_nfs, share_cifs)
def test_create_share(self, share):
self.mock_object(hds_hnas.HDSHNASDriver, "_check_fs_mounted",
self.mock_object(driver.HitachiHNASDriver, "_check_fs_mounted",
mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "vvol_create", mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "quota_add", mock.Mock())
@ -364,7 +364,7 @@ class HDSHNASTestCase(test.TestCase):
self.assertFalse(ssh.HNASSSHBackend.nfs_export_add.called)
def test_create_share_export_error(self):
self.mock_object(hds_hnas.HDSHNASDriver, "_check_fs_mounted",
self.mock_object(driver.HitachiHNASDriver, "_check_fs_mounted",
mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "vvol_create", mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "quota_add", mock.Mock())
@ -384,7 +384,7 @@ class HDSHNASTestCase(test.TestCase):
ssh.HNASSSHBackend.vvol_delete.assert_called_once_with(share_nfs['id'])
def test_create_share_invalid_share_protocol(self):
self.mock_object(hds_hnas.HDSHNASDriver, "_create_share",
self.mock_object(driver.HitachiHNASDriver, "_create_share",
mock.Mock(return_value="path"))
ex = self.assertRaises(exception.ShareBackendException,
@ -394,7 +394,7 @@ class HDSHNASTestCase(test.TestCase):
@ddt.data(share_nfs, share_cifs)
def test_delete_share(self, share):
self.mock_object(hds_hnas.HDSHNASDriver, "_check_fs_mounted",
self.mock_object(driver.HitachiHNASDriver, "_check_fs_mounted",
mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "nfs_export_del", mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "cifs_share_del", mock.Mock())
@ -452,8 +452,8 @@ class HDSHNASTestCase(test.TestCase):
def test_create_snapshot_cifs_exception(self):
cifs_excep_msg = ("Share backend error: CIFS snapshot when share is "
"mounted is disabled. Set "
"hds_hnas_allow_cifs_snapshot_while_mounted to True "
"or unmount the share to take a snapshot.")
"hitachi_hnas_allow_cifs_snapshot_while_mounted to "
"True or unmount the share to take a snapshot.")
self.mock_object(ssh.HNASSSHBackend, "is_cifs_in_use", mock.Mock(
return_value=True))
@ -486,7 +486,7 @@ class HDSHNASTestCase(test.TestCase):
def test_delete_snapshot(self):
hnas_id = snapshot_nfs['share_id']
self.mock_object(hds_hnas.HDSHNASDriver, "_check_fs_mounted")
self.mock_object(driver.HitachiHNASDriver, "_check_fs_mounted")
self.mock_object(ssh.HNASSSHBackend, "tree_delete", mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "delete_directory", mock.Mock())
@ -494,7 +494,7 @@ class HDSHNASTestCase(test.TestCase):
self.assertTrue(self.mock_log.debug.called)
self.assertTrue(self.mock_log.info.called)
hds_hnas.HDSHNASDriver._check_fs_mounted.assert_called_once_with()
driver.HitachiHNASDriver._check_fs_mounted.assert_called_once_with()
ssh.HNASSSHBackend.tree_delete.assert_called_once_with(
'/snapshots/' + hnas_id + '/' + snapshot_nfs['id'])
ssh.HNASSSHBackend.delete_directory.assert_called_once_with(
@ -637,7 +637,7 @@ class HDSHNASTestCase(test.TestCase):
@ddt.data([share_nfs, snapshot_nfs], [share_cifs, snapshot_cifs])
@ddt.unpack
def test_create_share_from_snapshot(self, share, snapshot):
self.mock_object(hds_hnas.HDSHNASDriver, "_check_fs_mounted",
self.mock_object(driver.HitachiHNASDriver, "_check_fs_mounted",
mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "vvol_create", mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "quota_add", mock.Mock())
@ -668,7 +668,7 @@ class HDSHNASTestCase(test.TestCase):
self.assertFalse(ssh.HNASSSHBackend.nfs_export_add.called)
def test_create_share_from_snapshot_empty_snapshot(self):
self.mock_object(hds_hnas.HDSHNASDriver, "_check_fs_mounted",
self.mock_object(driver.HitachiHNASDriver, "_check_fs_mounted",
mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "vvol_create", mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "quota_add", mock.Mock())
@ -691,7 +691,7 @@ class HDSHNASTestCase(test.TestCase):
share_nfs['id'])
def test_create_share_from_snapshot_invalid_protocol(self):
self.mock_object(hds_hnas.HDSHNASDriver, "_check_fs_mounted",
self.mock_object(driver.HitachiHNASDriver, "_check_fs_mounted",
mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "vvol_create", mock.Mock())
self.mock_object(ssh.HNASSSHBackend, "quota_add", mock.Mock())
@ -721,12 +721,12 @@ class HDSHNASTestCase(test.TestCase):
'share_backend_name': self._driver.backend_name,
'driver_handles_share_servers':
self._driver.driver_handles_share_servers,
'vendor_name': 'HDS',
'vendor_name': 'Hitachi',
'driver_version': '3.0.0',
'storage_protocol': 'NFS_CIFS',
'total_capacity_gb': 1000,
'free_capacity_gb': 200,
'reserved_percentage': hds_hnas.CONF.reserved_share_percentage,
'reserved_percentage': driver.CONF.reserved_share_percentage,
'qos': False,
'thin_provisioning': True,
'dedupe': True,
@ -734,7 +734,7 @@ class HDSHNASTestCase(test.TestCase):
self.mock_object(ssh.HNASSSHBackend, 'get_stats', mock.Mock(
return_value=(1000, 200, True)))
self.mock_object(hds_hnas.HDSHNASDriver, "_check_fs_mounted",
self.mock_object(driver.HitachiHNASDriver, "_check_fs_mounted",
mock.Mock())
self.mock_object(manila.share.driver.ShareDriver,
'_update_share_stats', mock.Mock())

View File

@ -23,7 +23,7 @@ import paramiko
import six
from manila import exception
from manila.share.drivers.hitachi import ssh
from manila.share.drivers.hitachi.hnas import ssh
from manila import test
from manila import utils as mutils
@ -505,7 +505,7 @@ class HNASSSHTestCase(test.TestCase):
'share_proto': 'nfs',
'size': 4,
'share_id': 'vvol_test',
'host': 'ubuntu@hds2#HDS2',
'host': 'ubuntu@hitachi2#HITACHI2',
}
def test_get_stats(self):

View File

@ -0,0 +1,20 @@
---
features:
- Renamed all HDS mentions on HNAS driver to Hitachi and moved driver to
another folder.
upgrade:
- HNAS driver vendor changed from HDS to Hitachi.
- New HNAS driver location.
- New HNAS config options hitachi_hnas_ip, hitachi_hnas_user,
hitachi_hnas_password, hitachi_hnas_evs_id, hitachi_hnas_evs_ip,
hitachi_hnas_file_system_name, hitachi_hnas_ssh_private_key,
hitachi_hnas_cluster_admin_ip0, hitachi_hnas_stalled_job_timeout,
hitachi_hnas_driver_helper and
hitachi_hnas_allow_cifs_snapshot_while_mounted.
deprecations:
- HNAS driver location was deprecated.
- All HNAS driver config options were deprecated hds_hnas_ip,
hds_hnas_user, hds_hnas_password, hds_hnas_evs_id, hds_hnas_evs_ip,
hds_hnas_file_system_name, hds_hnas_ssh_private_key,
hds_hnas_cluster_admin_ip0, hds_hnas_stalled_job_timeout,
hds_hnas_driver_helper and hds_hnas_allow_cifs_snapshot_while_mounted.