guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

05/05: tests: Test installation with a RAID root partition.


From: Ludovic Courtès
Subject: 05/05: tests: Test installation with a RAID root partition.
Date: Thu, 27 Oct 2016 11:50:07 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit 245cc5f5d55e8c0931a1a2d2becd78f9805de2df
Author: Ludovic Courtès <address@hidden>
Date:   Thu Oct 27 13:46:43 2016 +0200

    tests: Test installation with a RAID root partition.
    
    * gnu/tests/install.scm (%raid-root-os, %raid-root-os-source)
    (%raid-root-installation-script, %test-raid-root-os): New variables.
---
 gnu/tests/install.scm |   84 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)

diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index b3908ec..98f8649 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -34,6 +34,7 @@
   #:use-module (guix utils)
   #:export (%test-installed-os
             %test-separate-store-os
+            %test-raid-root-os
             %test-encrypted-os))
 
 ;;; Commentary:
@@ -301,6 +302,89 @@ where /gnu lives on a separate partition.")
 
 
 ;;;
+;;; RAID root device.
+;;;
+
+(define-os-with-source (%raid-root-os %raid-root-os-source)
+  ;; An OS whose root partition is a RAID partition.
+  (use-modules (gnu) (gnu tests))
+
+  (operating-system
+    (host-name "raidified")
+    (timezone "Europe/Paris")
+    (locale "en_US.utf8")
+
+    (bootloader (grub-configuration (device "/dev/vdb")))
+    (kernel-arguments '("console=ttyS0"))
+    (initrd (lambda (file-systems . rest)
+              ;; Add a kernel module for RAID-0 (aka. "stripe").
+              (apply base-initrd file-systems
+                     #:extra-modules '("raid0")
+                     rest)))
+    (mapped-devices (list (mapped-device
+                           (source (list "/dev/vda2" "/dev/vda3"))
+                           (target "/dev/md0")
+                           (type raid-device-mapping))))
+    (file-systems (cons (file-system
+                          (device "root-fs")
+                          (title 'label)
+                          (mount-point "/")
+                          (type "ext4")
+                          (dependencies mapped-devices))
+                        %base-file-systems))
+    (users %base-user-accounts)
+    (services (cons (service marionette-service-type
+                             (marionette-configuration
+                              (imported-modules '((gnu services herd)
+                                                  (guix combinators)))))
+                    %base-services))))
+
+(define %raid-root-installation-script
+  ;; Installation with a separate /gnu partition.  See
+  ;; <https://raid.wiki.kernel.org/index.php/RAID_setup> for more on RAID and
+  ;; mdadm.
+  "\
+. /etc/profile
+set -e -x
+guix --version
+
+export GUIX_BUILD_OPTIONS=--no-grafts
+parted --script /dev/vdb mklabel gpt \\
+  mkpart primary ext2 1M 3M \\
+  mkpart primary ext2 3M 600M \\
+  mkpart primary ext2 600M 1200M \\
+  set 1 boot on \\
+  set 1 bios_grub on
+mdadm --create /dev/md0 --verbose --level=stripe --raid-devices=2 \\
+  /dev/vdb2 /dev/vdb3
+mkfs.ext4 -L root-fs /dev/md0
+mount /dev/md0 /mnt
+df -h /mnt
+herd start cow-store /mnt
+mkdir /mnt/etc
+cp /etc/target-config.scm /mnt/etc/config.scm
+guix system init /mnt/etc/config.scm /mnt --no-substitutes
+sync
+reboot\n")
+
+(define %test-raid-root-os
+  (system-test
+   (name "raid-root-os")
+   (description
+    "Test functionality of an OS installed with a RAID root partition managed
+by 'mdadm'.")
+   (value
+    (mlet* %store-monad ((image   (run-install %raid-root-os
+                                               %raid-root-os-source
+                                               #:script
+                                               %raid-root-installation-script
+                                               #:target-size (* 1300 MiB)))
+                         (command (qemu-command/writable-image image)))
+      (run-basic-test %raid-root-os
+                      `(,@command) "raid-root-os")))))
+
+
+;;;
 ;;; LUKS-encrypted root file system.
 ;;;
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]