def setUp(self):
super(TestNexentaDriver, self).setUp()
self.configuration = mox_lib.MockObject(conf.Configuration)
- self.configuration.san_ip = '1.1.1.1'
- self.configuration.san_login = 'admin'
- self.configuration.san_password = 'nexenta'
+ self.configuration.nexenta_host = '1.1.1.1'
+ self.configuration.nexenta_user = 'admin'
+ self.configuration.nexenta_password = 'nexenta'
self.configuration.nexenta_volume = 'cinder'
self.configuration.nexenta_rest_port = 2000
self.configuration.nexenta_rest_protocol = 'http'
- self.configuration.iscsi_port = 3260
+ self.configuration.nexenta_iscsi_target_portal_port = 3260
self.configuration.nexenta_target_prefix = 'iqn:'
self.configuration.nexenta_target_group_prefix = 'cinder/'
self.configuration.nexenta_blocksize = '8K'
self._stub_all_export_methods()
self.mox.ReplayAll()
retval = self.drv.create_export({}, self.TEST_VOLUME_REF)
- self.assertEquals(
- retval,
- {'provider_location':
- '%s:%s,1 %s%s 0' % (self.configuration.san_ip,
- self.configuration.iscsi_port,
- self.configuration.nexenta_target_prefix,
- self.TEST_VOLUME_NAME)})
+ location = '%(host)s:%(port)s,1 %(prefix)s%(volume)s 0' % {
+ 'host': self.configuration.nexenta_host,
+ 'port': self.configuration.nexenta_iscsi_target_portal_port,
+ 'prefix': self.configuration.nexenta_target_prefix,
+ 'volume': self.TEST_VOLUME_NAME
+ }
+ self.assertEquals(retval, {'provider_location': location})
def __get_test(i):
def _test_create_export_fail(self):
from oslo.config import cfg
+
NEXENTA_CONNECTION_OPTIONS = [
+ cfg.StrOpt('nexenta_host',
+ default='',
+ help='IP address of Nexenta SA'),
cfg.IntOpt('nexenta_rest_port',
default=2000,
help='HTTP port to connect to Nexenta REST API server'),
cfg.StrOpt('nexenta_rest_protocol',
default='auto',
help='Use http or https for REST connection (default auto)'),
+ cfg.StrOpt('nexenta_user',
+ default='admin',
+ help='User name to connect to Nexenta SA'),
+ cfg.StrOpt('nexenta_password',
+ default='nexenta',
+ help='Password to connect to Nexenta SA',
+ secret=True),
]
NEXENTA_ISCSI_OPTIONS = [
+ cfg.IntOpt('nexenta_iscsi_target_portal_port',
+ default=3260,
+ help='Nexenta target portal port'),
cfg.StrOpt('nexenta_volume',
default='cinder',
help='pool on SA that will hold all volumes'),
auto = protocol == 'auto'
if auto:
protocol = 'http'
+ url = '%s://%s:%s/rest/nms/' % (protocol,
+ self.configuration.nexenta_host,
+ self.configuration.nexenta_rest_port)
self.nms = jsonrpc.NexentaJSONProxy(
- '%s://%s:%s/rest/nms/' % (protocol, self.configuration.san_ip,
- self.configuration.nexenta_rest_port),
- self.configuration.san_login, self.configuration.san_password,
- auto=auto)
+ url, self.configuration.nexenta_user,
+ self.configuration.nexenta_password, auto=auto)
def check_for_setup_error(self):
"""Verify that the volume for our zvols exists.
except nexenta.NexentaException as exc:
if ensure and 'already configured' in exc.args[0]:
target_already_configured = True
- LOG.exception(_('Ignored target creation error while ensuring '
- 'export'))
+ LOG.info(_('Ignored target creation error "%s" while ensuring '
+ 'export'), exc)
else:
raise
try:
if ((ensure and 'already exists' in exc.args[0]) or
(target_already_configured and
'target must be offline' in exc.args[0])):
- LOG.exception(_('Ignored target group creation error while '
- 'ensuring export'))
+ LOG.info(_('Ignored target group creation error "%s" while '
+ 'ensuring export'), exc)
else:
raise
try:
except nexenta.NexentaException as exc:
if ensure and ('already exists' in exc.args[0] or
'target must be offline' in exc.args[0]):
- LOG.exception(_('Ignored target group member addition error '
- 'while ensuring export'))
+ LOG.info(_('Ignored target group member addition error "%s" '
+ 'while ensuring export'), exc)
else:
raise
try:
except nexenta.NexentaException as exc:
if not ensure or 'in use' not in exc.args[0]:
raise
- LOG.exception(_('Ignored LU creation error while ensuring export'))
+ LOG.info(_('Ignored LU creation error "%s" while ensuring export'),
+ exc)
try:
self.nms.scsidisk.add_lun_mapping_entry(zvol_name, {
'target_group': target_group_name,
except nexenta.NexentaException as exc:
if not ensure or 'view entry exists' not in exc.args[0]:
raise
- LOG.exception(_('Ignored LUN mapping entry addition error while '
- 'ensuring export'))
- return '%s:%s,1 %s 0' % (self.configuration.san_ip,
- self.configuration.iscsi_port, target_name)
+ LOG.info(_('Ignored LUN mapping entry addition error "%s" while '
+ 'ensuring export'), exc)
+ return '%(host)s:%(port)s,1 %(name)s 0' % {
+ 'host': self.configuration.nexenta_host,
+ 'port': self.configuration.nexenta_iscsi_target_portal_port,
+ 'name': target_name
+ }
def create_export(self, _ctx, volume):
"""Create new export for zvol.
# Options defined in cinder.volume.drivers.nexenta.options
#
+# IP address of Nexenta SA (string value)
+#nexenta_host=
+
# HTTP port to connect to Nexenta REST API server (integer
# value)
#nexenta_rest_port=2000
# value)
#nexenta_rest_protocol=auto
+# User name to connect to Nexenta SA (string value)
+#nexenta_user=admin
+
+# Password to connect to Nexenta SA (string value)
+#nexenta_password=nexenta
+
+# Nexenta target portal port (integer value)
+#nexenta_iscsi_target_portal_port=3260
+
# pool on SA that will hold all volumes (string value)
#nexenta_volume=cinder
#volume_dd_blocksize=1M
-# Total option count: 342
+# Total option count: 346