[master] Sleep if the kickstart file read fails.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(migrated fe2eee125069269d32bc2bb3ea6c5722f450b28a from rhel5-branch)
I tested this on fedora 12, the loader is able to fetch kickstart from
a usb key.
---
 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..a9f781e 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;
     }
-- 
1.6.2.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux