summaryrefslogtreecommitdiffstats
path: root/iscsi.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2006-11-17 16:32:21 +0000
committerJeremy Katz <katzj@redhat.com>2006-11-17 16:32:21 +0000
commit7188627987f00f734e66b1357561072431ebc416 (patch)
tree60082982f58a48e576bffa8fdf4f120c02068e96 /iscsi.py
parent89d4651463e2d0e500cc275bb8ce7fd210d02ffc (diff)
downloadanaconda-7188627987f00f734e66b1357561072431ebc416.tar.gz
anaconda-7188627987f00f734e66b1357561072431ebc416.tar.xz
anaconda-7188627987f00f734e66b1357561072431ebc416.zip
2006-11-17 Jeremy Katz <katzj@redhat.com>
* iscsi.py (has_iscsi): Add a method so that we can find out if iscsi is really available (#216128) * iw/autopart_type.py (PartitionTypeWindow.addDrive): And don't allow trying to add iscsi drives if we don't have iscsi stuff. * textw/partition_text.py: Likewise.
Diffstat (limited to 'iscsi.py')
-rw-r--r--iscsi.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/iscsi.py b/iscsi.py
index a4180fdb3..1bc4d02cc 100644
--- a/iscsi.py
+++ b/iscsi.py
@@ -1,7 +1,8 @@
#
# iscsi.py - iscsi class
#
-# Copyright 2005, 2006 IBM, Inc.
+# Copyright 2005, 2006 IBM, Inc.,
+# Copyright 2006 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
@@ -29,6 +30,15 @@ ISCSID="/usr/sbin/iscsid"
ISCSIADM = "/usr/sbin/iscsiadm"
INITIATOR_FILE="/etc/iscsi/initiatorname.iscsi"
+
+def has_iscsi():
+ if not os.access(ISCSID, os.X_OK) or not os.access(ISCSIADM, os.X_OK):
+ return False
+ # make sure the module is loaded
+ if not os.access("/sys/modules/iscsi_tcp", os.X_OK):
+ return False
+ return True
+
class iscsiTarget:
def __init__(self, ipaddr, port = None, user = None, pw = None):
# FIXME: validate ipaddr
@@ -173,6 +183,8 @@ class iscsi(object):
def startup(self, intf = None):
if flags.test:
return
+ if not has_iscsi():
+ return
if not self.initiatorSet:
log.info("no initiator set")
return