From dea37cd21c4b17eae8217c7b2ed19b05063f1dc1 Mon Sep 17 00:00:00 2001 From: Nikolay Sobolevskiy Date: Thu, 15 Aug 2013 19:23:27 +0400 Subject: [PATCH] Extract ISCSI tries option into connector module 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 | 15 +++++++++++++-- cinder/volume/driver.py | 4 ---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cinder/brick/initiator/connector.py b/cinder/brick/initiator/connector.py index 7c637b66b..2560f7e7b 100644 --- a/cinder/brick/initiator/connector.py +++ b/cinder/brick/initiator/connector.py @@ -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() diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index e509fe405..da5458bc2 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -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'), -- 2.45.2