unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan <stefan-guix@vodafonemail.de>
To: 43219@debbugs.gnu.org
Subject: [bug#43219] [PATCH] gnu: Handle nfs-root device strings.
Date: Sat, 5 Sep 2020 13:26:25 +0200	[thread overview]
Message-ID: <4D0B1280-3FB5-48E5-B985-24773F966618@vodafonemail.de> (raw)

* gnu/bootloader/grub.scm (grub-root-search): Suppor nfs-root device strings to
set the root to tftp.
* gnu/build/file-systems.scm (canonicalize-device-spec): Support nfs-root device
strings.
* gnu/build/linux-boot.scm (device-string->file-system-device): Support nfs-root
device strings.
* gnu/machine/ssh.scm (machine-check-file-system-availability): Avoid checking
of nfs file systems as in guix/scripts/system.scm.
* gnu/system.scm (read-boot-parameters, device-sexp->device): Support nfs-root
device strings.

---
gnu/bootloader/grub.scm    |  3 +++
gnu/build/file-systems.scm |  3 ++-
gnu/build/linux-boot.scm   |  5 +++--
gnu/machine/ssh.scm        |  2 ++
gnu/system.scm             | 12 +++++++-----
5 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index b905ae360c..b3efcfa1db 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -295,6 +295,9 @@ code."
        ((? file-system-label? label)
         (format #f "search --label --set ~a"
                 (file-system-label->string label)))
+        ((? (lambda (device)
+              (and (string? device) (string-contains device ":/"))) nfs-uri)
+         "set root=(tftp)")
        ((or #f (? string?))
         #~(format #f "search --file --set ~a" #$file)))))

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 4ba1503b9f..734d648575 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -675,7 +675,8 @@ were found."
^L
(define (canonicalize-device-spec spec)
  "Return the device name corresponding to SPEC, which can be a <uuid>, a
-<file-system-label>, or a string (typically a /dev file name)."
+<file-system-label>, or a string (typically a /dev file name or an nfs-root
+containing ':/')."
  (define max-trials
    ;; Number of times we retry partition label resolution, 1 second per
    ;; trial.  Note: somebody reported a delay of 16 seconds (!) before their
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 80fe0cfb9d..32e3536039 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -469,9 +469,10 @@ upon error."

  (define (device-string->file-system-device device-string)
    ;; The "--root=SPEC" kernel command-line option always provides a
-    ;; string, but the string can represent a device, a UUID, or a
-    ;; label.  So check for all three.
+    ;; string, but the string can represent a device, an nfs-root, a UUID, or a
+    ;; label.  So check for all four.
    (cond ((string-prefix? "/" device-string) device-string)
+          ((string-contains device-string ":/") device-string) ; nfs-root
          ((uuid device-string) => identity)
          (else (file-system-label device-string))))

diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm
index 4e31baa4b9..35b42add48 100644
--- a/gnu/machine/ssh.scm
+++ b/gnu/machine/ssh.scm
@@ -172,6 +172,8 @@ exist on the machine."
              (and (file-system-mount? fs)
                   (not (member (file-system-type fs)
                                %pseudo-file-system-types))
+                   ;; Don't try to validate network file systems.
+                   (not (string-prefix? "nfs" (file-system-type fs)))
                   (not (memq 'bind-mount (file-system-flags fs)))))
            (operating-system-file-systems (machine-operating-system machine))))

diff --git a/gnu/system.scm b/gnu/system.scm
index f092df56ce..bdb696fe2e 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -316,11 +316,13 @@ file system labels."
      ((? bytevector? bv)                         ;old format
       (bytevector->uuid bv 'dce))
      ((? string? device)
-       ;; It used to be that we would not distinguish between labels and
-       ;; device names.  Try to infer the right thing here.
-       (if (string-prefix? "/dev/" device)
-           device
-           (file-system-label device)))))
+       (if (string-contains device ":/")
+           device ; nfs-root
+           ;; It used to be that we would not distinguish between labels and
+           ;; device names.  Try to infer the right thing here.
+           (if (string-prefix? "/" device)
+               device
+               (file-system-label device))))))

  (match (read port)
    (('boot-parameters ('version 0)
-- 
2.26.0





             reply	other threads:[~2020-09-05 11:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1A001E6C-A2C2-4364-B40D-C88059941CDF@vodafonemail.de>
2020-09-05 11:26 ` Stefan [this message]
2020-09-06 11:52   ` [bug#43219] [PATCH] gnu: Handle nfs-root device strings Stefan
2020-09-06 12:21     ` Danny Milosavljevic
2020-09-07  9:05   ` Danny Milosavljevic
2020-09-07 12:50     ` Stefan
2020-09-07 18:44       ` Stefan
2020-09-07 13:33     ` Danny Milosavljevic
2020-09-13 18:30     ` Stefan
2020-10-05  8:40       ` Ludovic Courtès
2020-10-05 16:31         ` bug#43219: " Stefan
2020-09-07  9:32   ` [bug#43219] Fwd: " Stefan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D0B1280-3FB5-48E5-B985-24773F966618@vodafonemail.de \
    --to=stefan-guix@vodafonemail.de \
    --cc=43219@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).