From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Tomas Volf <~@wolfsden.cz>
Cc: "Ludovic Courtès" <ludo@gnu.org>, 74510@debbugs.gnu.org
Subject: [bug#74510] [PATCH] doc: Document the (possible) need for network-online for NFS.
Date: Mon, 25 Nov 2024 10:08:26 +0900 [thread overview]
Message-ID: <87o724nmr9.fsf@gmail.com> (raw)
In-Reply-To: <2e43b85dce9d86ded76acc7acee234847c49a616.1732470232.git.~@wolfsden.cz> (Tomas Volf's message of "Sun, 24 Nov 2024 18:43:52 +0100")
Hi Tomas,
Tomas Volf <~@wolfsden.cz> writes:
> Depending on networking is not enough in some setups, so a language clarifying
> that and an example of network-online service.
>
> * doc/guix.texi (File Systems): Document the possible need for network-online.
>
> Change-Id: I8abe07cc9d6dc61f28eeea7ffa785eb8c9e8fd09
> ---
> doc/guix.texi | 28 +++++++++++++++++++++++++++-
> 1 file changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 26488b41c8..861e78e6d2 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -18018,7 +18018,33 @@ File Systems
> met before mounting the file system.
>
> As an example, an NFS file system would typically have a requirement for
> -@code{networking}.
> +@code{networking}. However be aware that depending on @code{networking}
> +might not be sufficient in some setups and a variant of custom
> +@code{network-online} service might be necessary.
Could we be more precise and detail a simple case or example of when
requiring 'network-online is needed over just 'network for NFS?
> Example:
> +
> +@lisp
> +(simple-service 'network-online shepherd-root-service-type
> + (list
> + (shepherd-service
> + (requirement '(networking))
> + (provision '(network-online))
> + (documentation "Wait for the network to come up.")
> + (start #~(lambda _
> + (let* ((cmd
> + "set -eux
> +c=0
> +while ! /run/setuid-programs/ping -qc1 -W1 example.org; do
> + sleep 1
> + [ \"$((c += 1))\" -lt 30 ] || exit 1 # Limit the wait time
> +done
> +")
> + (status (system cmd)))
> + (= 0 (status:exit-val status)))))
I'm pretty sure we have connectivity tests already in the Guix test
suite that must make use of Guile; that would be nicer, I think; for
example, the (guix tests) module has:
--8<---------------cut here---------------start------------->8---
(define (network-reachable?)
"Return true if we can reach the Internet."
(false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)))
--8<---------------cut here---------------end--------------->8---
> + ;; Ordering for one-shot? services does not currently work.
> + ;; https://issues.guix.gnu.org/74284
> + ;; (one-shot? #t)
> + )))
> +@end lisp
Otherwise, it looks like a useful addition.
--
Thanks,
Maxim
prev parent reply other threads:[~2024-11-25 1:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-24 17:43 [bug#74510] [PATCH] doc: Document the (possible) need for network-online for NFS Tomas Volf
2024-11-25 1:08 ` Maxim Cournoyer [this message]
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=87o724nmr9.fsf@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=74510@debbugs.gnu.org \
--cc=ludo@gnu.org \
--cc=~@wolfsden.cz \
/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).