diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-09-12 16:28:43 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-09-12 16:28:43 +0000 |
| commit | b961bd4c2916559bca856bc8b142d9df7494ef13 (patch) | |
| tree | 55de45f5d990caf2e0a8ee032491832239cfdd95 | |
| parent | ead54c8ccd3f2ed1c5848680839f50245f66e7bc (diff) | |
| parent | 3c79641a1310853b9f73a5ec5b6459ac88578ab8 (diff) | |
Merge "PowerVM: Establish SSH connection at use time"
| -rw-r--r-- | nova/virt/powervm/operator.py | 8 |
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() |
