diff options
author | Peter Jones <pjones@redhat.com> | 2007-01-31 20:47:02 +0000 |
---|---|---|
committer | Peter Jones <pjones@redhat.com> | 2007-01-31 20:47:02 +0000 |
commit | 038b720755fd4ca1138927aed1e384a573dca10d (patch) | |
tree | da6d6c4fa49c2da53dcfe5d019390da11c4a6a40 | |
parent | 522f17fb6b5557c160fd77a57d37dcc17d9a6c51 (diff) | |
download | anaconda-038b720755fd4ca1138927aed1e384a573dca10d.tar.gz anaconda-038b720755fd4ca1138927aed1e384a573dca10d.tar.xz anaconda-038b720755fd4ca1138927aed1e384a573dca10d.zip |
- backport of usb-storage support from HEAD
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | isys/isys.py | 53 | ||||
-rw-r--r-- | loader2/modules.c | 20 | ||||
-rw-r--r-- | partitions.py | 17 |
4 files changed, 71 insertions, 30 deletions
@@ -1,3 +1,14 @@ +2006-05-09 Peter Jones <pjones@redhat.com> + + * 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. + 2007-01-30 Peter Jones <pjones@redhat.com> * anaconda.spec: Bump version. diff --git a/isys/isys.py b/isys/isys.py index 78bd9265a..fc6a7257a 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -736,6 +736,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 @@ -744,30 +772,11 @@ def driveIsRemovable(device): else: makeDevInode(device, "/tmp/disk") rc = (_isys.isScsiRemovable("/tmp/disk") == 1) - - # need to test if its USB or 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', 'usb-storage']: - 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) diff --git a/loader2/modules.c b/loader2/modules.c index a3ae5ef34..8f80725db 100644 --- a/loader2/modules.c +++ b/loader2/modules.c @@ -332,6 +332,18 @@ static int loadModule(const char * modName, struct extractedModule * path, modLoaded->mods[num].firstDevNum = deviceCount; modLoaded->mods[num].lastDevNum = ethCount("tr") - 1; } else if (mi->major == DRIVER_SCSI) { + /* FIXME: this is a hack, but usb-storage seems to + * like to take forever to enumerate. try to + * give it some time */ + if (!strcmp(modName, "usb-storage")) { + int slp; + logMessage( "sleeping for usb-storage stabilize..."); + for (slp = 0; slp < 10; slp++) { + if (scsiDiskCount() > 0) break; + sleep(2); + } + logMessage( "slept %d seconds", slp * 2); + } modLoaded->mods[num].firstDevNum = deviceCount; modLoaded->mods[num].lastDevNum = scsiDiskCount(); } @@ -633,14 +645,6 @@ static int writeModulesConf(moduleList list, int fd) { if (!lm->weLoaded) continue; if (lm->written) continue; - /* JKFIXME: this is a hack for the fact that these are now - * DRIVER_SCSI so we can get /tmp/scsidisks, but we don't - * want them in modprobe.conf :/ */ - if (!strcmp(lm->name, "usb-storage") || - !strcmp(lm->name, "sbp2")) { - continue; - } - if (lm->major != DRIVER_NONE) { strcpy(buf, "alias "); switch (lm->major) { diff --git a/partitions.py b/partitions.py index d59aa48a9..bb5377a4e 100644 --- a/partitions.py +++ b/partitions.py @@ -825,6 +825,9 @@ class Partitions: foundSwap = 0 swapSize = 0 + usesUSB = False + usesFireWire = False + for request in self.requests: if request.fstype and request.fstype.getName() == "swap": foundSwap = foundSwap + 1 @@ -840,6 +843,20 @@ class Partitions: rc = request.sanityCheckRaid(self) if rc: errors.append(rc) + if not hasattr(request,'drive'): + continue + for x in request.drive: + if isys.driveUsesModule(x, ["usb-storage", "ub"]): + usesUSB = True + elif isys.driveUsesModule(x, ["sbp2"]): + usesFireWire = True + + if usesUSB: + warnings.append(_("Installing on a USB device. This may " + "or may not produce a working system.")) + if usesFireWire: + warnings.append(_("Installing on a FireWire device. This may " + "or may not produce a working system.")) bootreqs = self.getBootableRequest() if bootreqs: |