From: "Ludovic Courtès" <ludo@gnu.org>
To: Arun Isaac <arunisaac@systemreboot.net>
Cc: 28128@debbugs.gnu.org
Subject: [bug#28128] [PATCH 2/2] scripts: system: Support container network sharing.
Date: Wed, 13 Mar 2019 12:34:26 +0100 [thread overview]
Message-ID: <87va0n80u5.fsf@gnu.org> (raw)
In-Reply-To: <20190313093610.1071-3-arunisaac@systemreboot.net> (Arun Isaac's message of "Wed, 13 Mar 2019 15:06:10 +0530")
Hello!
Some comments below.
Arun Isaac <arunisaac@systemreboot.net> skribis:
> * gnu/services.scm (shared-network-service-type): New variable.
> * gnu/services/base.scm (%base-services): Add shared-network-service.
> * gnu/system.scm (essential-services): If shared-network-service exists,
> extend it to add /etc/services, /etc/nsswitch.conf and /etc/hosts.
> (operating-system-etc-service): Do not add /etc/services, /etc/nsswitch.conf
> and /etc/hosts.
> * gnu/system/linux-container.scm (container-script): Support returning a
> container script that shares the host network.
> * guix/scripts/system.scm (system-derivation-for-action, perform-action): Add
> #:container-shared-network? argument.
> (show-help): Add "-N, --network" help information.
> (%options): Add network option.
> (process-action): Call perform-action with #:container-shared-network?.
>
> Co-authored-by: Christopher Baines <mail@cbaines.net>
[...]
> +(define shared-network-service-type
> + (service-type (name 'shared-network)
> + (extensions (list (service-extension etc-service-type identity)))
> + (compose concatenate)
> + (extend append)
> + (default-value '())))
I’d encourage you to add a ‘description’ field as well. :-)
> --- a/gnu/system.scm
> +++ b/gnu/system.scm
> @@ -5,6 +5,7 @@
> ;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
> ;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com>
> +;;; Copyright © 2019 Arun Isaac <arunisaac@systemreboot.net>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -501,7 +502,21 @@ a container or that of a \"bare metal\" system."
> (list %containerized-shepherd-service)
> (list %linux-bare-metal-service
> (service firmware-service-type
> - (operating-system-firmware os))))))))
> + (operating-system-firmware os))))
> + (if (find (lambda (service)
> + (eq? (service-type-name (service-kind service))
> + 'shared-network))
> + (operating-system-user-services os))
> + (let ((nsswitch (plain-file "nsswitch.conf"
> + (name-service-switch->string
> + (operating-system-name-service-switch os)))))
> + (list (simple-service 'shared-network-extension
> + shared-network-service-type
> + `(("services" ,(file-append net-base "/etc/services"))
> + ("nsswitch.conf" ,#~#$nsswitch)
> + ("hosts" ,#~#$(or (operating-system-hosts-file os)
> + (default-/etc/hosts (operating-system-host-name os))))))))
> + (list))))))
A couple of things:
1. ‘service-type-name’ exists for debugging purposes, and I think we
shouldn’t rely on it at all in our code. Instead, we should
compare service types by identity, as in:
(eq? (service-kind service) foo-service-type)
2. The notion of “shared network” is very much a container (or VM)
thing, so somehow it still doesn’t feel right to me that (gnu
system) has to be aware of these special cases.
I think the ‘host-database-service-type’ wouldn’t have this problem, but
maybe it has other issues. I guess this needs more experimentation,
sorry for not coming up with clearer ideas!
Ludo’.
next prev parent reply other threads:[~2019-03-13 11:35 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-17 19:13 [bug#28128] [PATCH] scripts: system: Add support for container network sharing Christopher Baines
2017-09-04 21:47 ` Christopher Baines
2017-09-19 21:39 ` Ludovic Courtès
2017-09-20 7:04 ` Christopher Baines
2019-02-19 7:46 ` Arun Isaac
2019-02-19 21:50 ` Christopher Baines
2019-02-20 11:57 ` Ricardo Wurmus
2019-02-20 19:22 ` Arun Isaac
2019-03-04 13:38 ` Ludovic Courtès
2019-03-08 10:51 ` Arun Isaac
2019-03-10 17:20 ` Ludovic Courtès
2019-03-11 18:52 ` Arun Isaac
2019-03-13 9:36 ` [bug#28128] [PATCH 0/2] Support " Arun Isaac
2019-03-13 9:36 ` [bug#28128] [PATCH 1/2] shepherd: Move nscd-socket to (gnu system file-systems) Arun Isaac
2019-03-13 9:36 ` [bug#28128] [PATCH 2/2] scripts: system: Support container network sharing Arun Isaac
2019-03-13 11:34 ` Ludovic Courtès [this message]
2019-03-14 20:11 ` Arun Isaac
2019-03-18 8:37 ` Ludovic Courtès
2019-03-21 10:17 ` Arun Isaac
2019-03-22 17:29 ` Ludovic Courtès
2019-03-25 20:37 ` Arun Isaac
2019-05-10 12:54 ` Arun Isaac
2019-05-12 21:23 ` Ludovic Courtès
2019-05-13 8:30 ` Arun Isaac
2019-05-13 13:43 ` Ludovic Courtès
2019-05-13 21:26 ` bug#28128: " Arun Isaac
2019-05-14 7:02 ` [bug#28128] " Christopher Baines
2019-05-14 9:00 ` Arun Isaac
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87va0n80u5.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=28128@debbugs.gnu.org \
--cc=arunisaac@systemreboot.net \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.