guix-commits
[Top][All Lists]
Advanced

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

02/02: node-129: Update machine configuration, booting from SAN.


From: Maxim Cournoyer
Subject: 02/02: node-129: Update machine configuration, booting from SAN.
Date: Mon, 24 Apr 2023 14:59:41 -0400 (EDT)

apteryx pushed a commit to branch master
in repository maintenance.

commit 48573f3aafff35dbfde480a73d4bc2391dc3f4f1
Author: root <root@Ubuntu-22.04-server-amd64-GuixFarm>
AuthorDate: Mon Apr 24 16:48:02 2023 +0000

    node-129: Update machine configuration, booting from SAN.
    
    * hydra/deploy-node-129.scm (%btrfs-raid-uuid): Rename to...
    (%btrfs-san-uuid): ... this.
    (%common-btrfs-options): Remove degraded option.
    (%btrfs-pool): Rename to...
    (%btrfs-pool-san): ... this.
    (btrfs-subvolume-mount): Adjust accordingly.
    (%copy-kernel-and-initrd): New variable.
    (node-129-os) [initrd-modules]: New field.
    [bootloader]: Update targets.
    [file-system]: Update file systems.
    [services]: Register the copy-kernel+initrd-to-/boot service.
---
 hydra/deploy-node-129.scm | 85 +++++++++++++++++++++++++++++------------------
 1 file changed, 52 insertions(+), 33 deletions(-)

diff --git a/hydra/deploy-node-129.scm b/hydra/deploy-node-129.scm
index dfb6923..774c86a 100644
--- a/hydra/deploy-node-129.scm
+++ b/hydra/deploy-node-129.scm
@@ -28,6 +28,7 @@
              (gnu services mcron)
              (gnu services ssh)
              (gnu system file-systems)
+            (gnu system linux-initrd)
              (guix gexp)
              (sysadmin build-machines))
 
@@ -38,16 +39,14 @@
   ;; List of authorized 'guix archive' keys.
   (list (local-file "keys/guix/berlin.guixsd.org-export.pub")))
 
-(define %btrfs-raid-uuid "64a837b7-b9dc-4b64-ba95-712ba4032c71")
+(define %btrfs-san-uuid "3bd8e3fb-2ad1-41ff-ac80-4ca3e17950ea")
 
 (define %common-btrfs-options '(("compress" . "zstd")
-                                ("space_cache" . "v2")
-                                "degraded"))
+                                ("space_cache" . "v2")))
 
-;;; Top-level Btrfs subvolume.
-(define %btrfs-pool
+(define %btrfs-pool-san
   (file-system
-    (device (uuid %btrfs-raid-uuid))
+    (device (uuid %btrfs-san-uuid))
     (mount-point "/mnt/btrfs-pool")
     (create-mount-point? #t)
     (type "btrfs")
@@ -58,7 +57,7 @@
 (define (btrfs-subvolume-mount name mount-point)
   "Return a file system to mount the Btrfs subvolume NAME at MOUNT-POINT."
   (file-system
-    (device (uuid %btrfs-raid-uuid))
+    (device (uuid %btrfs-san-uuid))
     (mount-point mount-point)
     (create-mount-point? #t)
     (type "btrfs")
@@ -108,6 +107,29 @@ devices {
 }
 "))
 
+(define %copy-kernel-and-initrd
+  ;; The storage device where the root file system is is invisible to
+  ;; GRUB.  Thus, copy the kernel and initrd to /boot, where GRUB will
+  ;; be able to find them.
+  (with-imported-modules '((guix build utils))
+    #~(begin
+       (use-modules (guix build utils))
+
+       (for-each
+        (lambda (file)
+          (let ((target (string-append "/boot/@root/" file)))
+            (format #t "copying '~a' to /boot/@root/~%" file)
+            (mkdir-p (dirname target))
+            (copy-recursively file target)))
+
+        ;; /run/current-system/kernel is a profile.  The trick below
+        ;; allows us to get at its actual directory name, which is
+        ;; what 'grub.cfg' refers to.
+        (list (dirname
+               (canonicalize-path "/run/current-system/kernel/bzImage"))
+              (dirname (canonicalize-path "/run/current-system/initrd")))))))
+
+
 
 (define node-129-os
   (let ((base-os (berlin-new-build-machine-os
@@ -119,47 +141,44 @@ devices {
                   #:max-jobs 4
                   #:max-cores 24)))
     (operating-system
-      (inherit base-os)
-      (bootloader
-       (bootloader-configuration
-        (inherit (operating-system-bootloader base-os)) ;efi bootloader
-        (targets (list "/boot/efi" "/boot/efi2" "/boot/efi3"
-                              "/boot/efi4" "/boot/efi5" ))))
+     (inherit base-os)
+     (initrd-modules (append (list "megaraid_sas" "scsi_transport_sas"
+                                  "mpt3sas" "libsas"
+                                  ;; Suggested by 'guix system init' for
+                                  ;; the SAN storage.
+                                  "qla2xxx")
+                            %base-initrd-modules))
+     (bootloader
+      (bootloader-configuration
+       (inherit (operating-system-bootloader base-os)) ;efi bootloader
+       (targets (list "/boot/efi" "/boot/efi2"))))
       (packages
        (cons* multipath-tools
               (operating-system-packages base-os)))
       (file-systems (cons*
+                    (file-system
+                     (mount-point "/boot") ;/dev/sda3 and /dev/sdb3 in Btrfs 
RAID 1
+                     (device (uuid "f4ec81a5-3ea6-494b-8886-b71eec6721ee"))
+                     (type "btrfs")
+                     (options "compress=zstd"))
                     (file-system
                       (mount-point "/boot/efi")
-                      (device (uuid "B19B-79B3" 'fat)) ;/dev/sda2
+                      (device (uuid "FC8E-0264" 'fat)) ;/dev/sda2
                       (type "vfat"))
                     (file-system
                       (mount-point "/boot/efi2")
-                      (device (uuid "B1E1-D315" 'fat)) ;/dev/sdb2
-                      (type "vfat"))
-                    (file-system
-                      (mount-point "/boot/efi3")
-                      (device (uuid "B1FA-76F0" 'fat)) ;/dev/sdc2
-                      (type "vfat"))
-                    (file-system
-                      (mount-point "/boot/efi4")
-                      (device (uuid "FC8E-0264" 'fat)) ;/dev/sdd2
-                      (type "vfat"))
-                    (file-system
-                      (mount-point "/boot/efi5")
-                      (device (uuid "FCDB-FA3A" 'fat)) ;/dev/sde2
+                      (device (uuid "FCDB-FA3A" 'fat)) ;/dev/sdb2
                       (type "vfat"))
+                     %btrfs-pool-san   ;for convenience
                      (btrfs-subvolume-mount "@root"       "/")
-                    (btrfs-subvolume-mount "@etc"        "/etc")
                      (btrfs-subvolume-mount "@home"       "/home")
                      (btrfs-subvolume-mount "@cache"      "/var/cache")
-                     (btrfs-subvolume-mount "@log"        "/var/log")
-                     (btrfs-subvolume-mount "@secrets"    "/secrets")
-                     (btrfs-subvolume-mount "@srv"        "/srv")
-                     %btrfs-pool
                      %base-file-systems))
       (services
-       (cons* (simple-service 'etc-multipath.conf
+       (cons* (simple-service 'copy-kernel+initrd-to-/boot
+                             activation-service-type
+                             %copy-kernel-and-initrd)
+             (simple-service 'etc-multipath.conf
                               etc-service-type
                               (list `("multipath.conf" ,%multipath.conf)))
               (modify-services (operating-system-user-services base-os)



reply via email to

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