guix-patches
[Top][All Lists]
Advanced

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

[bug#35895] [PATCH] linux-container: Remove networking service when netw


From: Ludovic Courtès
Subject: [bug#35895] [PATCH] linux-container: Remove networking service when network is shared with host.
Date: Thu, 13 Jun 2019 23:02:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Hello,

Arun Isaac <address@hidden> skribis:

> From a7b795d9af3347330b48470d3988d43b8038c2c1 Mon Sep 17 00:00:00 2001
> From: Arun Isaac <address@hidden>
> Date: Sat, 25 May 2019 11:49:42 +0530
> Subject: [PATCH] linux-container: Remove networking service when network is
>  shared with host.
>
> * gnu/system/linux-container.scm (dummy-networking-shepherd-service): New
> procedure.
> (dummy-networking-service-type): New variable.
> (containerized-operating-system): If network is shared with host, replace
> static-networking-service-type with dummy-networking-service-type.

[...]

> +(define dummy-networking-shepherd-service
> +  (shepherd-service
> +   (documentation "Provide loopback and networking without actually doing
> +anything.")
> +   (provision '(loopback networking))
> +   (start #~(const #t))))
> +
> +(define dummy-networking-service-type
> +  (service-type
> +   (name 'dummy-networking)
> +   (extensions
> +    (list (service-extension
> +           shepherd-root-service-type
> +           (const (list dummy-networking-shepherd-service)))))
> +   (default-value #f)))

You can use ‘shepherd-service-type’ as a shorthand for these two
definitions.

> +    (services (append
> +               (remove (lambda (service)
> +                         (memq (service-kind service)
> +                               useless-services))
> +                       (operating-system-user-services os))
> +               ;; Many Guix services depend on a 'networking' shepherd
> +               ;; service, so make sure to provide a dummy 'networking'
> +               ;; service when we are sure that networking is already set up
> +               ;; in the host and can be used.  That prevents double setup.
> +               (if shared-network?
> +                   (list (service dummy-networking-service-type))
> +                   (list))))

I’m really nitpicking here, but I like to have the first argument to
‘append’ on the same line, and I also visually recognize '() more easily
than (list).

Anyway, LGTM!

Thanks,
Ludo’.





reply via email to

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