mapped-devices: Make RAID device opening message clearer.

* gnu/system/mapped-devices.scm (open-raid-device): Rename 'source' to
'sources'.  Make 'waiting' message more informative.
(close-raid-device): Rename 'source' to 'sources'.
This commit is contained in:
Ludovic Courtès 2016-08-02 12:27:57 +02:00
parent dfe06f6e7f
commit 7f8ad82bf2
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 17 additions and 13 deletions

View File

@ -128,20 +128,24 @@
(open open-luks-device) (open open-luks-device)
(close close-luks-device))) (close close-luks-device)))
(define (open-raid-device source target) (define (open-raid-device sources target)
"Return a gexp that assembles SOURCE (a list of devices) to the RAID device "Return a gexp that assembles SOURCES (a list of devices) to the RAID device
TARGET, using 'mdadm'." TARGET (e.g., \"/dev/md0\"), using 'mdadm'."
#~(let ((every (@ (srfi srfi-1) every))) #~(begin
(let loop () (use-modules (srfi srfi-1) (ice-9 format))
(unless (every file-exists? '#$source)
(format #t "waiting a bit...~%")
(sleep 1)
(loop)))
(zero? (system* (string-append #$mdadm "/sbin/mdadm")
"--assemble" #$target
#$@source))))
(define (close-raid-device source target) (let ((sources '#$sources))
(let loop ()
(unless (every file-exists? sources)
(format #t "waiting for RAID source devices~{ ~a~}...~%"
sources)
(sleep 1)
(loop)))
(zero? (system* (string-append #$mdadm "/sbin/mdadm")
"--assemble" #$target sources)))))
(define (close-raid-device sources target)
"Return a gexp that stops the RAID device TARGET." "Return a gexp that stops the RAID device TARGET."
#~(zero? (system* (string-append #$mdadm "/sbin/mdadm") #~(zero? (system* (string-append #$mdadm "/sbin/mdadm")
"--stop" #$target))) "--stop" #$target)))