]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix 3PAR driver hang on SSH calls
authorKurt Martin <kurt.f.martin@hp.com>
Mon, 15 Dec 2014 23:14:42 +0000 (15:14 -0800)
committerKurt Martin <kurt.f.martin@hp.com>
Tue, 16 Dec 2014 18:07:54 +0000 (10:07 -0800)
In removing the 3PAR driver local file locks, part of the fix included
making a new SSH connection for each call in the hp3parclient as
oppose to leaving a connection open. Older hp3parclients(3.1.1 and
later) will result in the SSH calls hanging at driver initilization time.

This patch will now check against the correct minimum hp3parclient version
and remove the need for checking of the SSH args version since the minimum
hp3parclient is now greater than 3.1.1
Closes-Bug: #1402115

Change-Id: Ic162a1a469e85fa36501d4de245fe16738d3aefa

cinder/tests/fake_hp_3par_client.py
cinder/tests/test_hp3par.py
cinder/volume/drivers/san/hp/hp_3par_common.py

index 85905448c3c4bccb21e1159847453932bfeb13dd..b6f19d5575681fe3ec67f963b4bfd219ab5ff3c9 100644 (file)
@@ -22,7 +22,7 @@ import mock
 from cinder.tests import fake_hp_client_exceptions as hpexceptions
 
 hp3par = mock.Mock()
-hp3par.version = "3.1.0"
+hp3par.version = "3.1.2"
 hp3par.exceptions = hpexceptions
 
 sys.modules['hp3parclient'] = hp3par
index d95df7c6a997a24a2e3045cc76415bdd96a87e99..93719067fa27f2e92d60f66b64880ea2faeb8bfb 100644 (file)
@@ -365,7 +365,9 @@ class HP3PARBaseDriver(object):
             HP3PAR_SAN_IP,
             HP3PAR_USER_NAME,
             HP3PAR_USER_PASS,
+            missing_key_policy='AutoAddPolicy',
             privatekey=HP3PAR_SAN_SSH_PRIVATE,
+            known_hosts_file=mock.ANY,
             port=HP3PAR_SAN_SSH_PORT,
             conn_timeout=HP3PAR_SAN_SSH_CON_TIMEOUT)]
 
@@ -421,20 +423,7 @@ class HP3PARBaseDriver(object):
         self.assertRaises(exception.InvalidInput,
                           self.setup_driver)
 
-    @mock.patch('hp3parclient.version', "3.1.0")
-    def test_ssh_options_310(self):
-
-        self.ctxt = context.get_admin_context()
-        mock_client = self.setup_mock_client(driver=hpfcdriver.HP3PARFCDriver)
-        expected = [
-            mock.call.getCPG(HP3PAR_CPG),
-            mock.call.getCPG(HP3PAR_CPG2)]
-        mock_client.assert_has_calls(
-            self.standard_login +
-            expected +
-            self.standard_logout)
-
-    @mock.patch('hp3parclient.version', "3.1.1")
+    @mock.patch('hp3parclient.version', "3.1.2")
     def test_ssh_options(self):
 
         expected_hosts_key_file = "test_hosts_key_file"
@@ -466,7 +455,7 @@ class HP3PARBaseDriver(object):
             expected +
             self.standard_logout)
 
-    @mock.patch('hp3parclient.version', "3.1.1")
+    @mock.patch('hp3parclient.version', "3.1.2")
     def test_ssh_options_strict(self):
 
         expected_hosts_key_file = "test_hosts_key_file"
index 3782894d37de029191ac4a2c21710d55adcf656c..0a697799b38acf26ef64f6b803b3897dd7d7915d 100644 (file)
@@ -69,8 +69,7 @@ from taskflow.patterns import linear_flow
 
 LOG = logging.getLogger(__name__)
 
-MIN_CLIENT_VERSION = '3.1.0'
-MIN_CLIENT_SSH_ARGS_VERSION = '3.1.1'
+MIN_CLIENT_VERSION = '3.1.2'
 
 hp3par_opts = [
     cfg.StrOpt('hp3par_api_url',
@@ -160,10 +159,11 @@ class HP3PARCommon(object):
         2.0.27 - Fixing manage source-id error bug #1357075
         2.0.28 - Removing locks bug #1381190
         2.0.29 - Report a limitless cpg's stats better bug #1398651
+        2.0.30 - Update the minimum hp3parclient version bug #1402115
 
     """
 
-    VERSION = "2.0.29"
+    VERSION = "2.0.30"
 
     stats = {}
 
@@ -238,30 +238,19 @@ class HP3PARCommon(object):
             LOG.error(msg)
             raise exception.InvalidInput(reason=msg)
 
-        client_version = hp3parclient.version
-
-        if client_version < MIN_CLIENT_SSH_ARGS_VERSION:
-            self.client.setSSHOptions(
-                self.config.san_ip,
-                self.config.san_login,
-                self.config.san_password,
-                port=self.config.san_ssh_port,
-                conn_timeout=self.config.ssh_conn_timeout,
-                privatekey=self.config.san_private_key)
-        else:
-            known_hosts_file = CONF.ssh_hosts_key_file
-            policy = "AutoAddPolicy"
-            if CONF.strict_ssh_host_key_policy:
-                policy = "RejectPolicy"
-            self.client.setSSHOptions(
-                self.config.san_ip,
-                self.config.san_login,
-                self.config.san_password,
-                port=self.config.san_ssh_port,
-                conn_timeout=self.config.ssh_conn_timeout,
-                privatekey=self.config.san_private_key,
-                missing_key_policy=policy,
-                known_hosts_file=known_hosts_file)
+        known_hosts_file = CONF.ssh_hosts_key_file
+        policy = "AutoAddPolicy"
+        if CONF.strict_ssh_host_key_policy:
+            policy = "RejectPolicy"
+        self.client.setSSHOptions(
+            self.config.san_ip,
+            self.config.san_login,
+            self.config.san_password,
+            port=self.config.san_ssh_port,
+            conn_timeout=self.config.ssh_conn_timeout,
+            privatekey=self.config.san_private_key,
+            missing_key_policy=policy,
+            known_hosts_file=known_hosts_file)
 
     def client_logout(self):
         LOG.info(_LI("Disconnect from 3PAR REST and SSH %s") % self.uuid)