From: Yosef Berman <yosef@cloudscaling.com>
Date: Thu, 20 Sep 2012 17:34:24 +0000 (-0700)
Subject: Fixes to the SolarisISCSI Driver
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=3b8a6303e6c04f0c7b45043c2fcd53948910d37e;p=openstack-build%2Fcinder-build.git

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
---

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):