From 582b4dfc7833f2adfea787cff5bce8e858d80d0e Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanino Date: Tue, 3 Mar 2015 17:49:03 -0500 Subject: [PATCH] Make unused iscsi_num_targets, iser_num_targets configs as deprecated 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 --- cinder/tests/conf_fixture.py | 2 -- cinder/tests/test_volume.py | 5 +---- cinder/volume/driver.py | 12 ++++++------ cinder/volume/targets/cxt.py | 16 ---------------- cinder/volume/targets/iscsi.py | 8 ++++++++ cinder/volume/targets/iser.py | 2 -- 6 files changed, 15 insertions(+), 30 deletions(-) diff --git a/cinder/tests/conf_fixture.py b/cinder/tests/conf_fixture.py index a31cd3ebc..009928cc1 100644 --- a/cinder/tests/conf_fixture.py +++ b/cinder/tests/conf_fixture.py @@ -21,7 +21,6 @@ from oslo_config import cfg 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', @@ -39,7 +38,6 @@ def set_defaults(conf): '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') diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py index 042aad298..eadaca78c 100644 --- a/cinder/tests/test_volume.py +++ b/cinder/tests/test_volume.py @@ -2411,8 +2411,7 @@ class VolumeTestCase(BaseVolumeTestCase): 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) @@ -5173,7 +5172,6 @@ class ISCSITestCase(DriverTestCase): 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 @@ -5307,7 +5305,6 @@ class ISERTestCase(DriverTestCase): 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 diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index 4e6ad3f29..a4b77f297 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -50,8 +50,9 @@ volume_opts = [ 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'), @@ -219,8 +220,9 @@ iser_opts = [ 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'), @@ -1697,8 +1699,6 @@ class ISERDriver(ISCSIDriver): # 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 = \ diff --git a/cinder/volume/targets/cxt.py b/cinder/volume/targets/cxt.py index c24e2495e..56c4cce1b 100644 --- a/cinder/volume/targets/cxt.py +++ b/cinder/volume/targets/cxt.py @@ -87,22 +87,6 @@ class CxtAdm(iscsi.ISCSITarget): 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] diff --git a/cinder/volume/targets/iscsi.py b/cinder/volume/targets/iscsi.py index d965c57da..aea40eaf9 100644 --- a/cinder/volume/targets/iscsi.py +++ b/cinder/volume/targets/iscsi.py @@ -17,6 +17,7 @@ from oslo_log import log as logging 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 @@ -42,6 +43,13 @@ class ISCSITarget(driver.Target): 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 diff --git a/cinder/volume/targets/iser.py b/cinder/volume/targets/iser.py index bf13b7c57..a6a3b5eea 100644 --- a/cinder/volume/targets/iser.py +++ b/cinder/volume/targets/iser.py @@ -39,8 +39,6 @@ class ISERTgtAdm(tgt.TgtAdm): # 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 = \ -- 2.45.2