# License for the specific language governing permissions and limitations
# under the License.
+import sys
+
import mock
from oslo_concurrency import processutils
from oslo_utils import units
from cinder import test
-import sys
+def fake_retry(exceptions, interval=1, retries=3, backoff_rate=2):
+ def _decorator(f):
+ return f
+ return _decorator
+
+mock.patch('cinder.utils.retry', fake_retry).start()
sys.modules['purestorage'] = mock.Mock()
from cinder.volume.drivers import pure
self._iscsi_port = self._choose_target_iscsi_port()
return self._iscsi_port
+ @utils.retry(exception.PureDriverException, retries=3)
def _choose_target_iscsi_port(self):
"""Find a reachable iSCSI-enabled port on target array."""
ports = self._array.list_ports()
except processutils.ProcessExecutionError as err:
LOG.debug(("iSCSI discovery of port %(port_name)s at "
"%(port_portal)s failed with error: %(err_msg)s"),
- {"port_name": self._iscsi_port["name"],
- "port_portal": self._iscsi_port["portal"],
+ {"port_name": port["name"],
+ "port_portal": port["portal"],
"err_msg": err.stderr})
else:
LOG.info(_LI("Using port %(name)s on the array at %(portal)s "