summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-09-12 16:28:43 +0000
committerGerrit Code Review <review@openstack.org>2012-09-12 16:28:43 +0000
commitb961bd4c2916559bca856bc8b142d9df7494ef13 (patch)
tree55de45f5d990caf2e0a8ee032491832239cfdd95 /nova
parentead54c8ccd3f2ed1c5848680839f50245f66e7bc (diff)
parent3c79641a1310853b9f73a5ec5b6459ac88578ab8 (diff)
Merge "PowerVM: Establish SSH connection at use time"
Diffstat (limited to 'nova')
-rw-r--r--nova/virt/powervm/operator.py8
1 files changed, 7 insertions, 1 deletions
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()