On 11/10/2009 01:29 PM, Chris Lumens wrote:
Then what we really need here is to see both patches being worked on at the same time. This is just a RHEL6 regression waiting to happen.
Attached is an attempt to forward-port the "sleep for usb devices" patch to the git master branch HEAD.
Jeff
loader/cdinstall.c | 8 ++++++++ loader/kickstart.c | 8 ++++++++ loader/method.c | 13 +++++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/loader/cdinstall.c b/loader/cdinstall.c index d74396e..602798f 100644 --- a/loader/cdinstall.c +++ b/loader/cdinstall.c @@ -490,6 +490,14 @@ int kickstartFromCD(char *kssrc) { logMessage(INFO, "getting kickstart file from first CDROM"); devices = getDevices(DEVICE_CDROM); + /* usb can take some time to settle, even with the various hacks we + * have in place. some systems use portable USB CD-ROM drives, try to + * make sure there really isn't one before bailing */ + for (i = 0; !devices && i < 10; ++i) { + logMessage(DEBUGLVL, "sleeping to wait for a USB CD-ROM"); + sleep(2); + devices = getDevices(DEVICE_CDROM); + } if (!devices) { logMessage(ERROR, "No CDROM devices found!"); return 1; diff --git a/loader/kickstart.c b/loader/kickstart.c index b92c6da..13ad35d 100644 --- a/loader/kickstart.c +++ b/loader/kickstart.c @@ -252,6 +252,14 @@ int kickstartFromRemovable(char *kssrc) { logMessage(INFO, "doing kickstart from removable media"); devices = getDevices(DEVICE_DISK); + /* usb can take some time to settle, even with the various hacks we + * have in place. some systems use portable USB CD-ROM drives, try to + * make sure there really isn't one before bailing */ + for (i = 0; !devices && i < 10; ++i) { + logMessage(DEBUGLVL, "sleeping to wait for a USB disk"); + sleep(2); + devices = getDevices(DEVICE_DISK); + } if (!devices) { logMessage(ERROR, "no disks"); return 1; diff --git a/loader/method.c b/loader/method.c index ebfe557..5cfc971 100644 --- a/loader/method.c +++ b/loader/method.c @@ -466,12 +466,21 @@ int copyFileAndLoopbackMount(int fd, char * dest, char * device, char * mntpoint 3 - file named path not there */ int getFileFromBlockDevice(char *device, char *path, char * dest) { - int rc; + int rc, s, i; char file[4096]; logMessage(INFO, "getFileFromBlockDevice(%s, %s)", device, path); - if (doPwMount(device, "/tmp/mnt", "auto", "ro", NULL)) { + /* some USB thumb drives and hard drives are slow to initialize */ + /* retry up to 5 times or 31 seconds */ + rc = doPwMount(device, "/tmp/mnt", "auto", "ro", NULL); + for (i = 0, s = 1; rc && i < 5; ++i) { + logMessage(DEBUGLVL, "sleeping to wait for USB storage devices"); + sleep(s); + s = 1 << (i+1); + rc = doPwMount(device, "/tmp/mnt", "auto", "ro", NULL); + } + if (rc) { logMessage(ERROR, "failed to mount /dev/%s: %m", device); return 2; }
_______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list