Fix 3PAR driver hang on SSH calls
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
This commit is contained in:
parent
40995e4434
commit
3f9770d2c0
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user