From cb9b36c94ba1652cf60e45ae1d96ba7bd41e5710 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Tue, 28 Aug 2012 19:57:54 +0400 Subject: 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 --- nova/utils.py | 4 ++-- nova/volume/san.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'nova') 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) -- cgit