Merge "Change code to be more Pythonic"
This commit is contained in:
commit
455332e3b3
|
@ -423,7 +423,7 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
|
||||||
# TODO(justinsb): This retry-with-delay is a pattern, move to utils?
|
# TODO(justinsb): This retry-with-delay is a pattern, move to utils?
|
||||||
tries = 0
|
tries = 0
|
||||||
# Loop until at least 1 path becomes available
|
# Loop until at least 1 path becomes available
|
||||||
while all(map(lambda x: not os.path.exists(x), host_devices)):
|
while all(not os.path.exists(x) for x in host_devices):
|
||||||
if tries >= self.device_scan_attempts:
|
if tries >= self.device_scan_attempts:
|
||||||
raise exception.VolumeDeviceNotFound(device=host_devices)
|
raise exception.VolumeDeviceNotFound(device=host_devices)
|
||||||
|
|
||||||
|
@ -436,12 +436,12 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
|
||||||
host_devices, target_props = (
|
host_devices, target_props = (
|
||||||
self._get_potential_volume_paths(connection_properties))
|
self._get_potential_volume_paths(connection_properties))
|
||||||
else:
|
else:
|
||||||
if (tries):
|
if tries:
|
||||||
host_devices = self._get_device_path(target_props)
|
host_devices = self._get_device_path(target_props)
|
||||||
self._run_iscsiadm(target_props, ("--rescan",))
|
self._run_iscsiadm(target_props, ("--rescan",))
|
||||||
|
|
||||||
tries = tries + 1
|
tries += 1
|
||||||
if all(map(lambda x: not os.path.exists(x), host_devices)):
|
if all(not os.path.exists(x) for x in host_devices):
|
||||||
time.sleep(tries ** 2)
|
time.sleep(tries ** 2)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue