From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duQFP-0007mo-9f for guix-patches@gnu.org; Tue, 19 Sep 2017 17:40:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duQFO-0005t6-AV for guix-patches@gnu.org; Tue, 19 Sep 2017 17:40:03 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:40075) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1duQFO-0005sz-6u for guix-patches@gnu.org; Tue, 19 Sep 2017 17:40:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1duQFN-0007Ic-TS for guix-patches@gnu.org; Tue, 19 Sep 2017 17:40:01 -0400 Subject: [bug#28128] [PATCH] scripts: system: Add support for container network sharing. In-Reply-To: <20170817191334.26269-1-mail@cbaines.net> Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170817191334.26269-1-mail@cbaines.net> <20170904214722.9572-1-mail@cbaines.net> Date: Tue, 19 Sep 2017 23:39:34 +0200 Message-ID: <87y3patlk9.fsf@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Christopher Baines Cc: 28128@debbugs.gnu.org Hi! Sorry for the delay! Christopher Baines skribis: > This is a port of the functionality in the Guix environment command to the > guix system container command. > > This requires additional changes to the operating-system definitions used= , in > particular, networking related services may need removing if the host net= work > is shared. > > * guix/scripts/system.scm (system-derivation-for-action): Add > #:container-shared-network? argument. > (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?. > * gnu/system/linux-container.scm (%network-configuration-files): New vari= able. > (container-script): Add support for returning a container script that s= hares > the host network. > * gnu/system.scm (essential-services): Add #:container-shared-network? > argument. > (operating-system-services): Add #:container-shared-network? argument. > (operating-system-etc-service): Add #:container-shared-network? argumen= t, > and support for ommiting some configuration if the network is shared. > (operating-system-activation-script): Add #:container-shared-network? > argument, and pass this through to the operating-system-services proced= ure. > (operating-system-boot-script): Add #:container-shared-network? argumen= t, > and pass this through to the operating-system-services procedure. > (operating-system-derivation): Add the #:container-shared-network? argu= ment, > and pass this through to the operating-system-services procedure. > (operating-system-profile): Add the #:container-shared-network? argumen= t, > and pass this through to the operating-system-services procedure. My gut reaction was =E2=80=9Chey this is cool!=E2=80=9D, and then =E2=80=9C= wait, it doesn=E2=80=99t feel right to pass that argument around everywhere!=E2=80=9D. :-) We already have that with #:container?, and I think that=E2=80=99s a bit of= a problem. The =E2=80=98linux-bare-metal=E2=80=99 service addresses it somew= hat in a more elegant way, I think. What about this: 1. Remove from =E2=80=98operating-system-etc-service=E2=80=99 all the shared-network-related files; 2. Add a =E2=80=98shared-network-service=E2=80=99 that simply adds those = file to /etc; 3. Add a =E2=80=98containerized-operating-system=E2=80=99 that removes it. There=E2=80=99s the problem, though, that /etc/hosts can only be added from =E2=80=98essential-services=E2=80=99. Now, this: +(define %network-configuration-files + '("/etc/resolv.conf" + "/etc/nsswitch.conf" + "/etc/services" + "/etc/hosts")) =E2=80=A6 is exactly what (gnu system file-systems) defines. Also, we should map the host=E2=80=99s /var/run/nscd/socket (if it exists) = in the guest, and remove nscd from the guest. Thoughts? Ludo=E2=80=99.