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
This commit is contained in:
Nikolay Sobolevskiy
2013-08-15 19:23:27 +04:00
parent e269a57358
commit dea37cd21c
2 changed files with 13 additions and 6 deletions

View 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()

View 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'),