From b33bf44eca13520587c94f00798988cee49475c9 Mon Sep 17 00:00:00 2001 From: Yosef Berman Date: Thu, 20 Sep 2012 10:34:24 -0700 Subject: [PATCH] Fixes to the SolarisISCSI Driver Even when the san_is_local config option was set to false, the SolarisISCSIDriver's _execute method was accidentally set to util.execute by the VolumeDriver's __init__ method. Fix bug 1053041 Change-Id: Ie3299f5065e2b084644ec2956f0c6ebae4264a49 (cherry picked from commit 3b8a6303e6c04f0c7b45043c2fcd53948910d37e) --- cinder/volume/san.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cinder/volume/san.py b/cinder/volume/san.py index b70c71fa3..fe98d50ca 100644 --- a/cinder/volume/san.py +++ b/cinder/volume/san.py @@ -72,7 +72,7 @@ san_opts = [ cfg.StrOpt('san_zfs_volume_base', default='rpool/', help='The ZFS path under which to create zvols for volumes.'), - ] +] FLAGS = flags.FLAGS FLAGS.register_opts(san_opts) @@ -86,8 +86,8 @@ class SanISCSIDriver(cinder.volume.driver.ISCSIDriver): remote protocol. """ - def __init__(self): - super(SanISCSIDriver, self).__init__() + def __init__(self, *args, **kwargs): + super(SanISCSIDriver, self).__init__(*args, **kwargs) self.run_local = FLAGS.san_is_local def _build_iscsi_target_name(self, volume): @@ -120,7 +120,7 @@ class SanISCSIDriver(cinder.volume.driver.ISCSIDriver): return utils.execute(*cmd, **kwargs) else: check_exit_code = kwargs.pop('check_exit_code', None) - command = ' '.join(*cmd) + command = ' '.join(cmd) return self._run_ssh(command, check_exit_code) def _run_ssh(self, command, check_exit_code=True): @@ -208,12 +208,15 @@ class SolarisISCSIDriver(SanISCSIDriver): Also make sure you can login using san_login & san_password/san_private_key """ + def __init__(self, *cmd, **kwargs): + super(SolarisISCSIDriver, self).__init__(*cmd, + execute=self._execute, + **kwargs) def _execute(self, *cmd, **kwargs): new_cmd = ['pfexec'] - new_cmd.extend(*cmd) - return super(SolarisISCSIDriver, self)._execute(self, - *new_cmd, + new_cmd.extend(cmd) + return super(SolarisISCSIDriver, self)._execute(*new_cmd, **kwargs) def _view_exists(self, luid): -- 2.45.2