]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Extract ISCSI tries option into connector module
authorNikolay Sobolevskiy <nsobolevsky@mirantis.com>
Thu, 15 Aug 2013 15:23:27 +0000 (19:23 +0400)
committerNikolay Sobolevskiy <nsobolevsky@mirantis.com>
Thu, 15 Aug 2013 17:10:11 +0000 (21:10 +0400)
The usage of this option occurred only in that module.
Rename this options to num_volume_device_scan_tries,
according to discussion on IRC.
The old one marked as depricated option.

DocImpact
Change-Id: Ib4a37237c2d95ca2dd6c05ce0a41f930b29ffd1c

cinder/brick/initiator/connector.py
cinder/volume/driver.py

index 7c637b66b66d927eb7f241b0f1c5c46a6cfc94a1..2560f7e7b8896aaf839d3060f174e419d5f8bf66 100644 (file)
@@ -33,7 +33,18 @@ from cinder.openstack.common import loopingcall
 from cinder.openstack.common import processutils as putils
 
 LOG = logging.getLogger(__name__)
+
+connector_opts = [
+    cfg.IntOpt('num_volume_device_scan_tries',
+               deprecated_name='num_iscsi_scan_tries',
+               default=3,
+               help='The maximum number of times to rescan targets'
+                    'to find volume'),
+]
+
 CONF = cfg.CONF
+CONF.register_opts(connector_opts)
+
 synchronized = lockutils.synchronized_with_prefix('brick-')
 
 
@@ -184,7 +195,7 @@ class ISCSIConnector(InitiatorConnector):
         # TODO(justinsb): This retry-with-delay is a pattern, move to utils?
         tries = 0
         while not os.path.exists(host_device):
-            if tries >= CONF.num_iscsi_scan_tries:
+            if tries >= CONF.num_volume_device_scan_tries:
                 raise exception.VolumeDeviceNotFound(device=host_device)
 
             LOG.warn(_("ISCSI volume not yet found at: %(host_device)s. "
@@ -544,7 +555,7 @@ class FibreChannelConnector(InitiatorConnector):
                     self.device_name = os.path.realpath(device)
                     raise loopingcall.LoopingCallDone()
 
-            if self.tries >= CONF.num_iscsi_scan_tries:
+            if self.tries >= CONF.num_volume_device_scan_tries:
                 msg = _("Fibre Channel volume device not found.")
                 LOG.error(msg)
                 raise exception.NoFibreChannelVolumeDeviceFound()
index e509fe4054129b5e706bac3af6c8674e837c0c23..da5458bc2ec0d37771a8224eac1567eaf084c218 100644 (file)
@@ -43,10 +43,6 @@ volume_opts = [
     cfg.IntOpt('reserved_percentage',
                default=0,
                help='The percentage of backend capacity is reserved'),
-    cfg.IntOpt('num_iscsi_scan_tries',
-               default=3,
-               help='The maximum number of times to rescan iSCSI target'
-                    'to find volume'),
     cfg.IntOpt('iscsi_num_targets',
                default=100,
                help='The maximum number of iscsi target ids per host'),