3
5
Fork 0
mirror of git://git.savannah.gnu.org/guix.git synced 2023-12-14 03:33:07 +01:00

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

View file

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