Dell SC: Add exclude_domain_ip option

If a domain iscsi portal should NOT be returned this allows
the user to specify that. Otherwise all domains are returned.

DocImpact
Closes-Bug: #1616499
Change-Id: Iaec89db402acb759304ea1d3fbb239ee73e4340e
(cherry-picked from commit 5fe72f8fb4)
This commit is contained in:
Tom Swanson 2016-08-23 11:23:09 -05:00
parent 2a7da4f627
commit 235594652b
2 changed files with 30 additions and 20 deletions

View File

@ -190,6 +190,9 @@ class StorageCenterApiHelper(object):
# about. # about.
connection.vfname = self.config.dell_sc_volume_folder connection.vfname = self.config.dell_sc_volume_folder
connection.sfname = self.config.dell_sc_server_folder connection.sfname = self.config.dell_sc_server_folder
connection.excluded_domain_ips = self.config.excluded_domain_ip
if not connection.excluded_domain_ips:
connection.excluded_domain_ips = []
# Set appropriate ssn and failover state. # Set appropriate ssn and failover state.
if self.active_backend_id: if self.active_backend_id:
# active_backend_id is a string. Convert to int. # active_backend_id is a string. Convert to int.
@ -252,6 +255,7 @@ class StorageCenterApi(object):
self.failed_over = False self.failed_over = False
self.vfname = 'openstack' self.vfname = 'openstack'
self.sfname = 'openstack' self.sfname = 'openstack'
self.excluded_domain_ips = []
self.legacypayloadfilters = False self.legacypayloadfilters = False
self.consisgroups = True self.consisgroups = True
self.apiversion = apiversion self.apiversion = apiversion
@ -1502,27 +1506,28 @@ class StorageCenterApi(object):
controller or not. controller or not.
:return: Nothing :return: Nothing
""" """
portals.append(address + ':' + if self.excluded_domain_ips.count(address) == 0:
six.text_type(port)) portals.append(address + ':' +
iqns.append(iqn) six.text_type(port))
luns.append(lun) iqns.append(iqn)
luns.append(lun)
# We've all the information. We need to find # We've all the information. We need to find
# the best single portal to return. So check # the best single portal to return. So check
# this one if it is on the right IP, port and # this one if it is on the right IP, port and
# if the access and status are correct. # if the access and status are correct.
if ((pdata['ip'] is None or pdata['ip'] == address) and if ((pdata['ip'] is None or pdata['ip'] == address) and
(pdata['port'] is None or pdata['port'] == port)): (pdata['port'] is None or pdata['port'] == port)):
# We need to point to the best link. # We need to point to the best link.
# So state active and status up is preferred # So state active and status up is preferred
# but we don't actually need the state to be # but we don't actually need the state to be
# up at this point. # up at this point.
if pdata['up'] == -1: if pdata['up'] == -1:
if active: if active:
pdata['active'] = len(iqns) - 1 pdata['active'] = len(iqns) - 1
if status == 'Up': if status == 'Up':
pdata['up'] = pdata['active'] pdata['up'] = pdata['active']
# Start by getting our mappings. # Start by getting our mappings.
mappings = self._find_mappings(scvolume) mappings = self._find_mappings(scvolume)

View File

@ -13,6 +13,7 @@
# under the License. # under the License.
from oslo_config import cfg from oslo_config import cfg
from oslo_config import types
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
@ -39,7 +40,11 @@ common_opts = [
help='Name of the volume folder to use on the Storage Center'), help='Name of the volume folder to use on the Storage Center'),
cfg.BoolOpt('dell_sc_verify_cert', cfg.BoolOpt('dell_sc_verify_cert',
default=False, default=False,
help='Enable HTTPS SC certificate verification.') help='Enable HTTPS SC certificate verification'),
cfg.MultiOpt('excluded_domain_ip',
item_type=types.IPAddress(),
default=None,
help='Domain IP to be excluded from iSCSI returns.')
] ]
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)