Skip to content
Snippets Groups Projects
Unverified Commit 7f8ad82b authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

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'.
parent dfe06f6e
No related branches found
No related tags found
No related merge requests found
......@@ -128,20 +128,24 @@ (define luks-device-mapping
(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 (close-raid-device source target)
(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))
(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)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment