]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
check the configuration eqlx_cli_max_retries
authorzhangchunlong1@huawei.com <zhangchunlong1@huawei.com>
Tue, 23 Sep 2014 08:18:50 +0000 (16:18 +0800)
committerzhangchunlong1@huawei.com <zhangchunlong1@huawei.com>
Sat, 11 Oct 2014 02:23:41 +0000 (10:23 +0800)
we need to to check the value of the configuration item eqlx_cli_max_retries
in the code in order to ensure the "eqlx_cli_max_retries" is equal to or
greater than 0

DocImpact: The 'retries' is not a configured number of attempts
Change-Id: If9fadda83a855b4bbda6129d3b3a64d296eb2b54
Closes-Bug: #1372454

cinder/volume/drivers/eqlx.py

index f7fbf16254fb051ad2efbd84a507d1426777eab7..635ce3dff7e8f9f761afd10a1caea617bc7795db 100644 (file)
@@ -217,9 +217,16 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
             with excutils.save_and_reraise_exception():
                 LOG.error(_("Error running SSH command: %s") % command)
 
+    def check_for_setup_error(self):
+        super(DellEQLSanISCSIDriver, self).check_for_setup_error()
+        if self.configuration.eqlx_cli_max_retries < 0:
+            raise exception.InvalidInput(
+                reason=_("eqlx_cli_max_retries must be greater than or "
+                         "equal to 0"))
+
     def _eql_execute(self, *args, **kwargs):
         return self._run_ssh(
-            args, attempts=self.configuration.eqlx_cli_max_retries)
+            args, attempts=self.configuration.eqlx_cli_max_retries + 1)
 
     def _get_volume_data(self, lines):
         prefix = 'iSCSI target name is '