After introducing new iscsi target driver model via Change-Id:
I43190d1dac33748fe55fa00f260f32ab209be656, configuration
options of iscsi_num_targets and iser_num_targets are not
used in these new scsi targets.
This patch makes these unused configuration options as
deprecated and adds warning messages to notify future removal
of these configs to users.
Also this patch removes _ensure_iscsi_targets() which uses these
two config options from cxt scsi target because this method is
never called anywhere.
Closes-Bug: #
1427904
DocImpact: Two unused config options are deprecated
Change-Id: Ic34910f4765f46e2708de7cb686e49418f486709
CONF = cfg.CONF
-CONF.import_opt('iscsi_num_targets', 'cinder.volume.drivers.lvm')
CONF.import_opt('policy_file', 'cinder.policy')
CONF.import_opt('volume_driver', 'cinder.volume.manager')
CONF.import_opt('xiv_ds8k_proxy',
'cinder.tests.fake_driver.FakeISCSIDriver')
conf.set_default('iscsi_helper', 'fake')
conf.set_default('rpc_backend', 'cinder.openstack.common.rpc.impl_fake')
- conf.set_default('iscsi_num_targets', 8)
conf.set_default('connection', 'sqlite://', group='database')
conf.set_default('sqlite_synchronous', False, group='database')
conf.set_default('policy_file', 'cinder/tests/policy.json')
self.assertNotIn(iscsi_target, targets)
targets.append(iscsi_target)
- total_slots = CONF.iscsi_num_targets
- for _index in xrange(total_slots):
+ for _index in xrange(100):
tests_utils.create_volume(self.context, **self.volume_params)
for volume_id in volume_ids:
self.volume.delete_volume(self.context, volume_id)
def setUp(self):
super(ISCSITestCase, self).setUp()
self.configuration = mox.MockObject(conf.Configuration)
- self.configuration.iscsi_num_targets = 100
self.configuration.iscsi_target_prefix = 'iqn.2010-10.org.openstack:'
self.configuration.iscsi_ip_address = '0.0.0.0'
self.configuration.iscsi_port = 3260
self.configuration = mock.Mock(conf.Configuration)
self.configuration.safe_get.return_value = None
self.configuration.num_iser_scan_tries = 3
- self.configuration.iser_num_targets = 100
self.configuration.iser_target_prefix = 'iqn.2010-10.org.openstack:'
self.configuration.iser_ip_address = '0.0.0.0'
self.configuration.iser_port = 3260
default=0,
help='The percentage of backend capacity is reserved'),
cfg.IntOpt('iscsi_num_targets',
- default=100,
- help='The maximum number of iSCSI target IDs per host'),
+ default=None,
+ help='This option is deprecated and unused. '
+ 'It will be removed in the Liberty release.'),
cfg.StrOpt('iscsi_target_prefix',
default='iqn.2010-10.org.openstack:',
help='Prefix for iSCSI volumes'),
help='The maximum number of times to rescan iSER target'
'to find volume'),
cfg.IntOpt('iser_num_targets',
- default=100,
- help='The maximum number of iSER target IDs per host'),
+ default=None,
+ help='This option is deprecated and unused. '
+ 'It will be removed in the Liberty release.'),
cfg.StrOpt('iser_target_prefix',
default='iqn.2010-10.org.openstack:',
help='Prefix for iSER volumes'),
# for backward compatibility
self.configuration.num_volume_device_scan_tries = \
self.configuration.num_iser_scan_tries
- self.configuration.iscsi_num_targets = \
- self.configuration.iser_num_targets
self.configuration.iscsi_target_prefix = \
self.configuration.iser_target_prefix
self.configuration.iscsi_ip_address = \
iscsi_target = 1
return iscsi_target, lun
- def _ensure_iscsi_targets(self, context, host):
- """Ensure that target ids have been created in datastore."""
- # NOTE : This is probably not required for chiscsi
- # TODO(jdg): In the future move all of the dependent stuff into the
- # cooresponding target admin class
- host_iscsi_targets = self.db.iscsi_target_count_by_host(context,
- host)
- if host_iscsi_targets >= self.configuration.iscsi_num_targets:
- return
-
- # NOTE Chiscsi target ids start at 1.
- target_end = self.configuration.iscsi_num_targets + 1
- for target_num in xrange(1, target_end):
- target = {'host': host, 'target_num': target_num}
- self.db.iscsi_target_create_safe(context, target)
-
def _get_target_chap_auth(self, context, name):
volumes_dir = self._get_volumes_dir()
vol_id = name.split(':')[1]
from cinder import exception
from cinder.i18n import _, _LI, _LW, _LE
+from cinder.openstack.common import versionutils
from cinder import utils
from cinder.volume.targets import driver
from cinder.volume import utils as vutils
self.protocol = 'iSCSI'
self.volumes_dir = self.configuration.safe_get('volumes_dir')
+ # If any of the deprecated options are set, we'll warn the operator.
+ msg = _LW("The option %s has been deprecated and no longer has "
+ "any effect. It will be removed in the Liberty release.")
+ for opt in ('iscsi_num_targets', 'iser_num_targets'):
+ if self.configuration.safe_get(opt) is not None:
+ versionutils.report_deprecated_feature(LOG, msg, opt)
+
def _get_iscsi_properties(self, volume, multipath=False):
"""Gets iscsi configuration
# backwards compatibility mess
self.configuration.num_volume_device_scan_tries = \
self.configuration.num_iser_scan_tries
- self.configuration.iscsi_num_targets = \
- self.configuration.iser_num_targets
self.configuration.iscsi_target_prefix = \
self.configuration.iser_target_prefix
self.configuration.iscsi_ip_address = \