]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Make unused iscsi_num_targets, iser_num_targets configs as deprecated
authorMitsuhiro Tanino <mitsuhiro.tanino@hds.com>
Tue, 3 Mar 2015 22:49:03 +0000 (17:49 -0500)
committerMitsuhiro Tanino <mitsuhiro.tanino@hds.com>
Mon, 16 Mar 2015 18:33:54 +0000 (14:33 -0400)
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
cinder/tests/test_volume.py
cinder/volume/driver.py
cinder/volume/targets/cxt.py
cinder/volume/targets/iscsi.py
cinder/volume/targets/iser.py

index a31cd3ebc5b9eb90745d1633f988ada6fa5971b0..009928cc148e8673f29dfc430c4b43ae420396a4 100644 (file)
@@ -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')
index 042aad2984bd612ee3d854686a2c594880dbadb1..eadaca78c971a37430243e8e70c9c07a45aaadef 100644 (file)
@@ -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
index 4e6ad3f2964e50d42e5aaeee2112150b06b40db3..a4b77f297ba4616ec759f32bf0d2227bf23ee032 100644 (file)
@@ -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 = \
index c24e2495e3247956cefa305a3132bb3726dd2b2e..56c4cce1bebdc25f4168ab28f620f748d6f84127 100644 (file)
@@ -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]
index d965c57dada9d275e03af981fd8517e2b1949289..aea40eaf9c411641b6f41fcff5b81eb8c3cdc31f 100644 (file)
@@ -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
 
index bf13b7c5722e1811f45465af07d1812267bec63f..a6a3b5eea4f49ff27d968abff0cc783cd5daeef7 100644 (file)
@@ -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 = \