summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorYuriy Taraday <yorik.sar@gmail.com>2012-08-28 19:57:54 +0400
committerDina Belova <dbelova@mirantis.com>2012-10-23 22:29:38 +0400
commitcb9b36c94ba1652cf60e45ae1d96ba7bd41e5710 (patch)
treed23ff962d2bf34f636050230b352d0fea48bb14e /nova
parentbff0ee67779eafb4872e1d8ef8d36c311fd2424b (diff)
downloadnova-cb9b36c94ba1652cf60e45ae1d96ba7bd41e5710.tar.gz
nova-cb9b36c94ba1652cf60e45ae1d96ba7bd41e5710.tar.xz
nova-cb9b36c94ba1652cf60e45ae1d96ba7bd41e5710.zip
SanISCSIDriver SSH execution fixes.
In ssh_execute methon in nova/utils there was a problem with cmd passed to it. From SanISCSIDriver and all other places it is called from cmd is a string. But in ssh_execute method cmd was processed as a list. This can make problems with SanISCSIdriver using. Also it may be useful to pass execute parameter to this SanISCSIDriver class to have the opportunity of overriding _execute method (as it is in VolumeDriver class, that is the root of this class hierarchy). That's why special checking was added. Fixes bug 1070489 Change-Id: I73f74f9d095a2c4316cab88148afe6a0bde44c5b
Diffstat (limited to 'nova')
-rw-r--r--nova/utils.py4
-rw-r--r--nova/volume/san.py8
2 files changed, 7 insertions, 5 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 015ff915a..5d4863cf7 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -249,7 +249,7 @@ def trycmd(*args, **kwargs):
def ssh_execute(ssh, cmd, process_input=None,
addl_env=None, check_exit_code=True):
- LOG.debug(_('Running cmd (SSH): %s'), ' '.join(cmd))
+ LOG.debug(_('Running cmd (SSH): %s'), cmd)
if addl_env:
raise exception.NovaException(_('Environment not supported over SSH'))
@@ -279,7 +279,7 @@ def ssh_execute(ssh, cmd, process_input=None,
raise exception.ProcessExecutionError(exit_code=exit_status,
stdout=stdout,
stderr=stderr,
- cmd=' '.join(cmd))
+ cmd=cmd)
return (stdout, stderr)
diff --git a/nova/volume/san.py b/nova/volume/san.py
index 22147141a..cf4507f31 100644
--- a/nova/volume/san.py
+++ b/nova/volume/san.py
@@ -86,8 +86,10 @@ class SanISCSIDriver(nova.volume.driver.ISCSIDriver):
remote protocol.
"""
- def __init__(self, *args, **kwargs):
- super(SanISCSIDriver, self).__init__(*args, **kwargs)
+ def __init__(self, execute=None, *args, **kwargs):
+ if execute is None:
+ execute = self._execute
+ super(SanISCSIDriver, self).__init__(execute, *args, **kwargs)
self.run_local = FLAGS.san_is_local
def _build_iscsi_target_name(self, volume):
@@ -119,7 +121,7 @@ class SanISCSIDriver(nova.volume.driver.ISCSIDriver):
if self.run_local:
return utils.execute(*cmd, **kwargs)
else:
- check_exit_code = kwargs.pop('check_exit_code', None)
+ check_exit_code = kwargs.pop('check_exit_code', True)
command = ' '.join(cmd)
return self._run_ssh(command, check_exit_code)