summary refs log tree commit diff
path: root/gnu/tests/ganeti.scm
diff options
context:
space:
mode:
authorBruno Victal <mirai@makinata.eu>2023-01-27 21:06:12 +0000
committerLudovic Courtès <ludo@gnu.org>2023-02-09 01:07:47 +0100
commit802ea1f3a43e5fb8d0b8bd2882954d8a6e49cde6 (patch)
tree3adf9c824a6531b7ad74fc21bcba080772be7bc2 /gnu/tests/ganeti.scm
parent22dd558c70901a336de97187f0470be584571158 (diff)
downloadguix-802ea1f3a43e5fb8d0b8bd2882954d8a6e49cde6.tar.gz
system: Deprecate hosts-file.
* gnu/system.scm (operating-system-hosts-file): Deprecate procedure.
(warn-hosts-file-field-deprecation): New procedure, helper for
deprecated variable.
(operating-system)[hosts-file]: Use helper to warn deprecated field.
(local-host-aliases): Mark as deprecated.
(local-host-entries): New procedure.
(operating-system-default-essential-services,
hurd-default-essential-services): Use hosts-service-type.  Use
'%operating-system-hosts-file' and 'local-host-entries'.
(default-/etc/hosts): Remove procedure.
(operating-system-etc-service): Remove hosts file.
* doc/guix.texi (operating-system Reference)
(Networking Services) (Virtualization Services): Rewrite documentation
entries to use hosts-service-type.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/tests/ganeti.scm')
-rw-r--r--gnu/tests/ganeti.scm26
1 files changed, 16 insertions, 10 deletions
diff --git a/gnu/tests/ganeti.scm b/gnu/tests/ganeti.scm
index f647e9554c..b5624b7598 100644
--- a/gnu/tests/ganeti.scm
+++ b/gnu/tests/ganeti.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2020, 2021 Marius Bakke <marius@gnu.org>
 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -22,6 +23,7 @@
   #:use-module (gnu tests)
   #:use-module (gnu system vm)
   #:use-module (gnu services)
+  #:use-module (gnu services base)
   #:use-module (gnu services ganeti)
   #:use-module (gnu services networking)
   #:use-module (gnu services ssh)
@@ -46,18 +48,15 @@
                         %base-file-systems))
     (firmware '())
 
-    ;; The hosts file must contain a nonlocal IP for host-name.
-    ;; In addition, the cluster name must resolve to an IP address that
-    ;; is not currently provisioned.
-    (hosts-file (plain-file "hosts" (format #f "
-127.0.0.1       localhost
-::1             localhost
-10.0.2.15       gnt1.example.com gnt1
-192.168.254.254 ganeti.example.com
-")))
-
     (packages (append (list ganeti-instance-debootstrap ganeti-instance-guix)
                       %base-packages))
+
+    ;; The hosts file must contain a nonlocal IP for host-name.
+    (essential-services
+     (modify-services (operating-system-default-essential-services this-operating-system)
+       (hosts-service-type config => (list
+                                      (host "127.0.0.1" "localhost")
+                                      (host "::1"       "localhost")))))
     (services
      (append (list (service static-networking-service-type
                             (list %qemu-static-networking))
@@ -65,6 +64,13 @@
                             (openssh-configuration
                              (permit-root-login 'prohibit-password)))
 
+                   ;; In addition, the cluster name must resolve to an IP address that
+                   ;; is not currently provisioned.
+                   (simple-service 'ganeti-host-entries hosts-service-type
+                                   (list
+                                    (host "10.0.2.15" "gnt1.example.com" '("gnt1"))
+                                    (host "192.168.254.254" "ganeti.example.com")))
+
                    (service ganeti-service-type
                             (ganeti-configuration
                              (file-storage-paths '("/srv/ganeti/file-storage"))