summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuperStack <superstack@superstack.org>2011-02-09 11:18:48 -0800
committerSuperStack <superstack@superstack.org>2011-02-09 11:18:48 -0800
commitd4b4fa93e7603d73eb99c8edb0e648ff047cda30 (patch)
tree8919558c696ad42d51b4706dc8ffc9d7b20beb7d
parent636bf106d5fc0424b9045e79ea18fb74406e070c (diff)
downloadnova-d4b4fa93e7603d73eb99c8edb0e648ff047cda30.tar.gz
nova-d4b4fa93e7603d73eb99c8edb0e648ff047cda30.tar.xz
nova-d4b4fa93e7603d73eb99c8edb0e648ff047cda30.zip
Fix PEP8 violations
-rw-r--r--nova/utils.py1
-rw-r--r--nova/volume/san.py19
2 files changed, 12 insertions, 8 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 100e26f70..8d7ff1f64 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -187,6 +187,7 @@ def ssh_execute(ssh, cmd, process_input=None,
return (stdout, stderr)
+
def abspath(s):
return os.path.join(os.path.dirname(__file__), s)
diff --git a/nova/volume/san.py b/nova/volume/san.py
index 1f3417ae5..e7d559a2a 100644
--- a/nova/volume/san.py
+++ b/nova/volume/san.py
@@ -42,6 +42,7 @@ flags.DEFINE_string('san_password', '',
flags.DEFINE_string('san_privatekey', '',
'Filename of private key to use for SSH authentication')
+
class SanISCSIDriver(ISCSIDriver):
""" Base class for SAN-style storage volumes
(storage providers we access over SSH)"""
@@ -68,7 +69,8 @@ class SanISCSIDriver(ISCSIDriver):
volume_name)
iscsi_portal = location.split(",")[0]
- LOG.debug("iscsi_name=%s, iscsi_portal=%s" % (iscsi_name, iscsi_portal))
+ LOG.debug("iscsi_name=%s, iscsi_portal=%s" %
+ (iscsi_name, iscsi_portal))
return (iscsi_name, iscsi_portal)
def _build_iscsi_target_name(self, volume):
@@ -89,7 +91,9 @@ class SanISCSIDriver(ISCSIDriver):
privatekeyfile = os.path.expanduser(FLAGS.san_privatekey)
# It sucks that paramiko doesn't support DSA keys
privatekey = paramiko.RSAKey.from_private_key_file(privatekeyfile)
- ssh.connect(FLAGS.san_ip, username=FLAGS.san_login, pkey=privatekey)
+ ssh.connect(FLAGS.san_ip,
+ username=FLAGS.san_login,
+ pkey=privatekey)
else:
raise exception.Error("Specify san_password or san_privatekey")
return ssh
@@ -125,6 +129,7 @@ class SanISCSIDriver(ISCSIDriver):
if not (FLAGS.san_ip):
raise exception.Error("san_ip must be set")
+
def _collect_lines(data):
""" Split lines from data into an array, trimming them """
matches = []
@@ -134,6 +139,7 @@ def _collect_lines(data):
return matches
+
def _get_prefixed_values(data, prefix):
"""Collect lines which start with prefix; with trimming"""
matches = []
@@ -146,6 +152,7 @@ def _get_prefixed_values(data, prefix):
return matches
+
class SolarisISCSIDriver(SanISCSIDriver):
"""Executes commands relating to Solaris-hosted ISCSI volumes.
Basic setup for a Solaris iSCSI server:
@@ -165,8 +172,8 @@ class SolarisISCSIDriver(SanISCSIDriver):
"""
def _view_exists(self, luid):
- (out, _err) = self._run_ssh("pfexec /usr/sbin/stmfadm list-view -l %s" %
- (luid),
+ cmd = "pfexec /usr/sbin/stmfadm list-view -l %s" % (luid)
+ (out, _err) = self._run_ssh(cmd,
check_exit_code=False)
if "no views found" in out:
return False
@@ -229,9 +236,6 @@ class SolarisISCSIDriver(SanISCSIDriver):
sizestr,
zfs_poolname))
- return { # 'target_ip': FLAGS.san_ip
- }
-
def _get_luid(self, volume):
zfs_poolname = self._build_zfs_poolname(volume)
@@ -329,4 +333,3 @@ class SolarisISCSIDriver(SanISCSIDriver):
if self._is_lu_created(volume):
self._run_ssh("pfexec /usr/sbin/sbdadm delete-lu %s" %
(luid))
-