diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2016-08-02 12:34:14 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2016-08-02 13:53:25 +0200 |
| commit | 873b51b34057d9d13c628289f57b10dec07b2060 (patch) | |
| tree | fd8fb9d86c4d3af5e68ab54d9dc05bd7c728a5a7 | |
| parent | 7f8ad82bf23b032ad6bd85bb1daa87cc83de509c (diff) | |
mapped-devices: Bail out when RAID sources don't show up.
* gnu/system/mapped-devices.scm (open-raid-device): Bail out after 20
loop iterations.
| -rw-r--r-- | gnu/system/mapped-devices.scm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm index 2a0706e50b0..ce0a78a2ad5 100644 --- a/gnu/system/mapped-devices.scm +++ b/gnu/system/mapped-devices.scm | |||
| @@ -135,12 +135,16 @@ TARGET (e.g., \"/dev/md0\"), using 'mdadm'." | |||
| 135 | (use-modules (srfi srfi-1) (ice-9 format)) | 135 | (use-modules (srfi srfi-1) (ice-9 format)) |
| 136 | 136 | ||
| 137 | (let ((sources '#$sources)) | 137 | (let ((sources '#$sources)) |
| 138 | (let loop () | 138 | (let loop ((attempts 0)) |
| 139 | (unless (every file-exists? sources) | 139 | (unless (every file-exists? sources) |
| 140 | (when (> attempts 20) | ||
| 141 | (error "RAID devices did not show up; bailing out" | ||
| 142 | sources)) | ||
| 143 | |||
| 140 | (format #t "waiting for RAID source devices~{ ~a~}...~%" | 144 | (format #t "waiting for RAID source devices~{ ~a~}...~%" |
| 141 | sources) | 145 | sources) |
| 142 | (sleep 1) | 146 | (sleep 1) |
| 143 | (loop))) | 147 | (loop (+ 1 attempts)))) |
| 144 | 148 | ||
| 145 | (zero? (system* (string-append #$mdadm "/sbin/mdadm") | 149 | (zero? (system* (string-append #$mdadm "/sbin/mdadm") |
| 146 | "--assemble" #$target sources))))) | 150 | "--assemble" #$target sources))))) |
