From 3c79641a1310853b9f73a5ec5b6459ac88578ab8 Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Wed, 12 Sep 2012 14:33:34 +0200 Subject: PowerVM: Establish SSH connection at use time Establish SSH connection at use time in PowerVM compute driver, in order to work around a paramiko error on slow networks. Patch based on a proposal by David Peraza. Fixes bug 1040785. Change-Id: I1a656981fae2f384c748c077d608018a0aafb681 --- nova/virt/powervm/operator.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'nova') diff --git a/nova/virt/powervm/operator.py b/nova/virt/powervm/operator.py index da90af650..9097c6962 100644 --- a/nova/virt/powervm/operator.py +++ b/nova/virt/powervm/operator.py @@ -317,9 +317,13 @@ class BaseOperator(object): information to connect to the remote ssh. """ - self._connection = common.ssh_connect(connection) + self._connection = None self.connection_data = connection + def _set_connection(self): + if self._connection is None: + self._connection = common.ssh_connect(self.connection_data) + def get_lpar(self, instance_name, resource_type='lpar'): """Return a LPAR object by its instance name. @@ -640,6 +644,7 @@ class BaseOperator(object): :param command: String with the command to run. """ + self._set_connection() stdout, stderr = utils.ssh_execute(self._connection, cmd, check_exit_code=check_exit_code) return stdout.strip().splitlines() @@ -649,6 +654,7 @@ class BaseOperator(object): :param command: List of commands. """ + self._set_connection() stdout, stderr = common.ssh_command_as_root( self._connection, command, check_exit_code=check_exit_code) return stdout.read().splitlines() -- cgit