diff options
author | Peter Jones <pjones@redhat.com> | 2006-05-09 20:33:04 +0000 |
---|---|---|
committer | Peter Jones <pjones@redhat.com> | 2006-05-09 20:33:04 +0000 |
commit | fd705d16441d50018dfaccab6e3ade05d9db8c50 (patch) | |
tree | 4018fd27e2d97b660f0628a7ed6e9d079eec50b4 /isys | |
parent | 85841a182b2ac9655c59b138e346afa8c2c42153 (diff) | |
download | anaconda-fd705d16441d50018dfaccab6e3ade05d9db8c50.tar.gz anaconda-fd705d16441d50018dfaccab6e3ade05d9db8c50.tar.xz anaconda-fd705d16441d50018dfaccab6e3ade05d9db8c50.zip |
* isys/isys.py (driveIsRemovable): Split module checking out to its
own functions. Allow usb-storage installs.
* partitions.py: warn if you're using firewire or usb
* loader2/modules.c (loadModule): Delay on reloading usb-storage, as
it takes undefined time as well. Without this /tmp/scsidisks is
wrong.
* loader2/modules.c (writeModulesConf): don't exclude usb-storage
or sbp2.
Diffstat (limited to 'isys')
-rw-r--r-- | isys/isys.py | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/isys/isys.py b/isys/isys.py index c52b70b34..0e107cf39 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -746,6 +746,34 @@ def ejectCdrom(device, makeDevice = 1): if makeDevice: os.unlink("/tmp/cdrom") +def driveUsesModule(device, modules): + """Returns true if a drive is using a prticular module. Only works + for SCSI devices right now.""" + + if not isinstance(modules, ().__class__) and not \ + isinstance(modules, [].__class__): + modules = [modules] + + if device[:2] == "hd": + return False + rc = False + if os.access("/tmp/scsidisks", os.R_OK): + sdlist=open("/tmp/scsidisks", "r") + sdlines = sdlist.readlines() + sdlist.close() + for l in sdlines: + try: + # each line has format of: <device> <module> + (sddev, sdmod) = string.split(l) + + if sddev == device: + if sdmod in modules: + rc = True + break + except: + pass + return rc + def driveIsRemovable(device): # assume ide if starts with 'hd', and we don't have to create # device beforehand since it just reads /proc/ide @@ -754,30 +782,11 @@ def driveIsRemovable(device): else: makeDevInode(device, "/tmp/disk") rc = (_isys.isScsiRemovable("/tmp/disk") == 1) - - # need to test if its IEEE1394 even if it doesnt look removable - if not rc: - if os.access("/tmp/scsidisks", os.R_OK): - sdlist=open("/tmp/scsidisks", "r") - sdlines = sdlist.readlines() - sdlist.close() - for l in sdlines: - try: - # each line has format of: <device> <module> - (sddev, sdmod) = string.split(l) - - if sddev == device: - if sdmod in ['sbp2']: - rc = 1 - else: - rc = 0 - break - except: - pass - os.unlink("/tmp/disk") + if rc: + return rc - return rc + return False def vtActivate (num): _isys.vtActivate (num) |