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.
This commit is contained in:
Ludovic Courtès 2016-08-02 12:34:14 +02:00
parent 7f8ad82bf2
commit 873b51b340
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 6 additions and 2 deletions

View File

@ -135,12 +135,16 @@ TARGET (e.g., \"/dev/md0\"), using 'mdadm'."
(use-modules (srfi srfi-1) (ice-9 format))
(let ((sources '#$sources))
(let loop ()
(let loop ((attempts 0))
(unless (every file-exists? sources)
(when (> attempts 20)
(error "RAID devices did not show up; bailing out"
sources))
(format #t "waiting for RAID source devices~{ ~a~}...~%"
sources)
(sleep 1)
(loop)))
(loop (+ 1 attempts))))
(zero? (system* (string-append #$mdadm "/sbin/mdadm")
"--assemble" #$target sources)))))