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:
		
							parent
							
								
									7f8ad82bf2
								
							
						
					
					
						commit
						873b51b340
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		|  | @ -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))))) | ||||
|  |  | |||
		Reference in a new issue