mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
services: ganeti: OS variants can be a directory.
* gnu/services/ganeti.scm (<ganeti-os>)[extension]: Default to #f. (ganeti-os->directory): Only add extension if set. Support a file-like object for VARIANTS. * doc/guix.texi (Virtualization Services): Document this change and add example. Update Ganeti URLs while at it.
This commit is contained in:
parent
614a92cae8
commit
706f25f24d
2 changed files with 67 additions and 37 deletions
|
@ -33941,7 +33941,7 @@ cluster node that supports multiple storage backends, and installs the
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
Users are advised to read the
|
Users are advised to read the
|
||||||
@url{http://docs.ganeti.org/ganeti/master/html/admin.html,Ganeti
|
@url{https://docs.ganeti.org/docs/ganeti/3.0/html/admin.html,Ganeti
|
||||||
administrators guide} to learn about the various cluster options and
|
administrators guide} to learn about the various cluster options and
|
||||||
day-to-day operations. There is also a
|
day-to-day operations. There is also a
|
||||||
@url{https://guix.gnu.org/blog/2020/running-a-ganeti-cluster-on-guix/,blog post}
|
@url{https://guix.gnu.org/blog/2020/running-a-ganeti-cluster-on-guix/,blog post}
|
||||||
|
@ -34030,12 +34030,30 @@ The name for this OS provider. It is only used to specify where the
|
||||||
configuration ends up. Setting it to ``debootstrap'' will create
|
configuration ends up. Setting it to ``debootstrap'' will create
|
||||||
@file{/etc/ganeti/instance-debootstrap}.
|
@file{/etc/ganeti/instance-debootstrap}.
|
||||||
|
|
||||||
@item @code{extension}
|
@item @code{extension} (default: @code{#f})
|
||||||
The file extension for variants of this OS type. For example
|
The file extension for variants of this OS type. For example @file{.conf}
|
||||||
@file{.conf} or @file{.scm}.
|
or @file{.scm}. It will be appended to the variant file name if set.
|
||||||
|
|
||||||
@item @code{variants} (default: @code{'()})
|
@item @code{variants} (default: @code{'()})
|
||||||
List of @code{ganeti-os-variant} objects for this OS.
|
This must be either a list of @code{ganeti-os-variant} objects for this OS,
|
||||||
|
or a ``file-like'' object (@pxref{G-Expressions, file-like objects})
|
||||||
|
representing the variants directory.
|
||||||
|
|
||||||
|
To use the Guix OS provider with variant definitions residing in a local
|
||||||
|
directory instead of declaring individual variants (see @var{guix-variants}
|
||||||
|
below), you can do:
|
||||||
|
|
||||||
|
@lisp
|
||||||
|
(ganeti-os
|
||||||
|
(name "guix")
|
||||||
|
(variants (local-file "ganeti-guix-variants"
|
||||||
|
#:recursive? #true)))
|
||||||
|
@end lisp
|
||||||
|
|
||||||
|
Note that you will need to maintain the @file{variants.list} file
|
||||||
|
(see @code{@url{https://docs.ganeti.org/docs/ganeti/3.0/man/ganeti-os-interface.html,
|
||||||
|
ganeti-os-interface(7)}})
|
||||||
|
manually in this case.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
@end deftp
|
@end deftp
|
||||||
|
@ -34318,7 +34336,7 @@ via a JSON-based RPC protocol.
|
||||||
Most query operations are allowed without authentication (unless
|
Most query operations are allowed without authentication (unless
|
||||||
@var{require-authentication?} is set), whereas write operations require
|
@var{require-authentication?} is set), whereas write operations require
|
||||||
explicit authorization via the @file{/var/lib/ganeti/rapi/users} file. See
|
explicit authorization via the @file{/var/lib/ganeti/rapi/users} file. See
|
||||||
the @url{http://docs.ganeti.org/ganeti/master/html/rapi.html, Ganeti Remote
|
the @url{https://docs.ganeti.org/docs/ganeti/3.0/html/rapi.html, Ganeti Remote
|
||||||
API documentation} for more information.
|
API documentation} for more information.
|
||||||
|
|
||||||
The value of this service must be a @code{ganeti-rapi-configuration} object.
|
The value of this service must be a @code{ganeti-rapi-configuration} object.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
|
;;; Copyright © 2020, 2022 Marius Bakke <marius@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -819,8 +819,9 @@ (define ganeti-mcron-jobs
|
||||||
(define-record-type* <ganeti-os>
|
(define-record-type* <ganeti-os>
|
||||||
ganeti-os make-ganeti-os ganeti-os?
|
ganeti-os make-ganeti-os ganeti-os?
|
||||||
(name ganeti-os-name) ;string
|
(name ganeti-os-name) ;string
|
||||||
(extension ganeti-os-extension) ;string
|
(extension ganeti-os-extension ;#f | string
|
||||||
(variants ganeti-os-variants ;list of <ganeti-os-variant>
|
(default #f))
|
||||||
|
(variants ganeti-os-variants ;<file-like> | list of <ganeti-os-variant>
|
||||||
(default '())))
|
(default '())))
|
||||||
|
|
||||||
(define-record-type* <ganeti-os-variant>
|
(define-record-type* <ganeti-os-variant>
|
||||||
|
@ -992,35 +993,46 @@ (define-gexp-compiler (debootstrap-configuration-compiler
|
||||||
(define (ganeti-os->directory os)
|
(define (ganeti-os->directory os)
|
||||||
"Return the derivation to build the configuration directory to be installed
|
"Return the derivation to build the configuration directory to be installed
|
||||||
in /etc/ganeti/instance-$os for OS."
|
in /etc/ganeti/instance-$os for OS."
|
||||||
(let* ((name (ganeti-os-name os))
|
(let ((name (ganeti-os-name os))
|
||||||
(extension (ganeti-os-extension os))
|
(extension (ganeti-os-extension os))
|
||||||
(variants (ganeti-os-variants os))
|
(variants (ganeti-os-variants os)))
|
||||||
(names (map ganeti-os-variant-name variants))
|
|
||||||
(configs (map ganeti-os-variant-configuration variants)))
|
|
||||||
(with-imported-modules '((guix build utils))
|
|
||||||
(define builder
|
(define builder
|
||||||
|
(with-imported-modules '((guix build utils))
|
||||||
|
(if (file-like? variants)
|
||||||
|
#~(begin
|
||||||
|
(use-modules (guix build utils))
|
||||||
|
(mkdir-p #$output)
|
||||||
|
(symlink #$variants
|
||||||
|
(string-append #$output "/variants")))
|
||||||
#~(begin
|
#~(begin
|
||||||
(use-modules (guix build utils)
|
(use-modules (guix build utils)
|
||||||
(ice-9 format)
|
(ice-9 format)
|
||||||
(ice-9 match)
|
(ice-9 match)
|
||||||
(srfi srfi-1))
|
(srfi srfi-1))
|
||||||
(mkdir-p #$output)
|
(mkdir-p #$output)
|
||||||
(unless (null? '#$names)
|
(let ((variants-dir (string-append #$output "/variants"))
|
||||||
(let ((variants-dir (string-append #$output "/variants")))
|
(names '#$(map ganeti-os-variant-name variants))
|
||||||
|
(configs '#$(map ganeti-os-variant-configuration variants)))
|
||||||
(mkdir-p variants-dir)
|
(mkdir-p variants-dir)
|
||||||
(call-with-output-file (string-append variants-dir "/variants.list")
|
(unless (null? names)
|
||||||
|
(call-with-output-file (string-append variants-dir
|
||||||
|
"/variants.list")
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
(format port "~a~%"
|
(format port "~a~%"
|
||||||
(string-join '#$names "\n"))))
|
(string-join names "\n"))))
|
||||||
(for-each (match-lambda
|
(for-each (match-lambda
|
||||||
((name file)
|
((name file)
|
||||||
|
(let ((file-name
|
||||||
|
(if #$extension
|
||||||
|
(string-append name #$extension)
|
||||||
|
name)))
|
||||||
(symlink file
|
(symlink file
|
||||||
(string-append variants-dir "/" name
|
(string-append variants-dir "/"
|
||||||
#$extension))))
|
file-name)))))
|
||||||
|
(zip names configs))))))))
|
||||||
|
|
||||||
'#$(zip names configs))))))
|
(computed-file (string-append name "-os") builder
|
||||||
|
#:local-build? #t)))
|
||||||
(computed-file (string-append name "-os") builder))))
|
|
||||||
|
|
||||||
(define (ganeti-directory file-storage-file os)
|
(define (ganeti-directory file-storage-file os)
|
||||||
(let ((dirs (map ganeti-os->directory os))
|
(let ((dirs (map ganeti-os->directory os))
|
||||||
|
|
Loading…
Reference in a new issue