services: ganeti: Add support for cluster hooks.
* gnu/services/ganeti.scm (<ganeti-configuration>): Add HOOKS. (hooks->directory): Rename to ... (debootstrap-hooks->directory): ... this, for clarity. (debootstrap-configuration-compiler): Adjust accordingly. (ganeti-directory): Add HOOKS when set. (ganeti-etc-service): Pass HOOKS. * doc/guix.texi (Virtualization Services): Mention it.
This commit is contained in:
parent
491bddfa27
commit
88908c6edc
@ -34249,6 +34249,10 @@ To override a setting, you must use the configuration type for that service:
|
|||||||
@item @code{file-storage-paths} (default: @code{'()})
|
@item @code{file-storage-paths} (default: @code{'()})
|
||||||
List of allowed directories for file storage backend.
|
List of allowed directories for file storage backend.
|
||||||
|
|
||||||
|
@item @code{hooks} (default: @code{#f})
|
||||||
|
When set, this should be a file-like object containing a directory with
|
||||||
|
@url{https://docs.ganeti.org/docs/ganeti/3.0/html/hooks.html,cluster execution hooks}.
|
||||||
|
|
||||||
@item @code{os} (default: @code{%default-ganeti-os})
|
@item @code{os} (default: @code{%default-ganeti-os})
|
||||||
List of @code{<ganeti-os>} records.
|
List of @code{<ganeti-os>} records.
|
||||||
@end table
|
@end table
|
||||||
|
@ -777,6 +777,8 @@ than 21 days from @file{/var/lib/ganeti/queue/archive}.")))
|
|||||||
(default (ganeti-cleaner-configuration)))
|
(default (ganeti-cleaner-configuration)))
|
||||||
(file-storage-paths ganeti-configuration-file-storage-paths ;list of strings | gexp
|
(file-storage-paths ganeti-configuration-file-storage-paths ;list of strings | gexp
|
||||||
(default '()))
|
(default '()))
|
||||||
|
(hooks ganeti-configuration-hooks ;<file-like> | #f
|
||||||
|
(default #f))
|
||||||
(os ganeti-configuration-os ;list of <ganeti-os>
|
(os ganeti-configuration-os ;list of <ganeti-os>
|
||||||
(default '())))
|
(default '())))
|
||||||
|
|
||||||
@ -910,7 +912,7 @@ trap - EXIT
|
|||||||
(partition-alignment debootstrap-configuration-partition-alignment ;#f | integer
|
(partition-alignment debootstrap-configuration-partition-alignment ;#f | integer
|
||||||
(default 2048)))
|
(default 2048)))
|
||||||
|
|
||||||
(define (hooks->directory hooks)
|
(define (debootstrap-hooks->directory hooks)
|
||||||
(match hooks
|
(match hooks
|
||||||
((? file-like?)
|
((? file-like?)
|
||||||
hooks)
|
hooks)
|
||||||
@ -918,7 +920,7 @@ trap - EXIT
|
|||||||
(let ((names (map car hooks))
|
(let ((names (map car hooks))
|
||||||
(files (map cdr hooks)))
|
(files (map cdr hooks)))
|
||||||
(with-imported-modules '((guix build utils))
|
(with-imported-modules '((guix build utils))
|
||||||
(computed-file "hooks-union"
|
(computed-file "debootstrap-hooks"
|
||||||
#~(begin
|
#~(begin
|
||||||
(use-modules (guix build utils)
|
(use-modules (guix build utils)
|
||||||
(ice-9 match))
|
(ice-9 match))
|
||||||
@ -942,7 +944,7 @@ trap - EXIT
|
|||||||
(($ <debootstrap-configuration> hooks proxy mirror arch suite extra-pkgs
|
(($ <debootstrap-configuration> hooks proxy mirror arch suite extra-pkgs
|
||||||
components generate-cache? clean-cache
|
components generate-cache? clean-cache
|
||||||
partition-style partition-alignment)
|
partition-style partition-alignment)
|
||||||
(let ((customize-dir (hooks->directory hooks)))
|
(let ((customize-dir (debootstrap-hooks->directory hooks)))
|
||||||
(gexp->derivation
|
(gexp->derivation
|
||||||
"debootstrap-variant"
|
"debootstrap-variant"
|
||||||
#~(call-with-output-file (ungexp output "out")
|
#~(call-with-output-file (ungexp output "out")
|
||||||
@ -1034,7 +1036,7 @@ in /etc/ganeti/instance-$os for OS."
|
|||||||
(computed-file (string-append name "-os") builder
|
(computed-file (string-append name "-os") builder
|
||||||
#:local-build? #t)))
|
#:local-build? #t)))
|
||||||
|
|
||||||
(define (ganeti-directory file-storage-file os)
|
(define (ganeti-directory file-storage-file hooks os)
|
||||||
(let ((dirs (map ganeti-os->directory os))
|
(let ((dirs (map ganeti-os->directory os))
|
||||||
(names (map ganeti-os-name os)))
|
(names (map ganeti-os-name os)))
|
||||||
(define builder
|
(define builder
|
||||||
@ -1044,6 +1046,9 @@ in /etc/ganeti/instance-$os for OS."
|
|||||||
(when #$file-storage-file
|
(when #$file-storage-file
|
||||||
(symlink #$file-storage-file
|
(symlink #$file-storage-file
|
||||||
(string-append #$output "/file-storage-paths")))
|
(string-append #$output "/file-storage-paths")))
|
||||||
|
(when #$hooks
|
||||||
|
(symlink #$hooks
|
||||||
|
(string-append #$output "/hooks")))
|
||||||
(for-each (match-lambda
|
(for-each (match-lambda
|
||||||
((name dest)
|
((name dest)
|
||||||
(symlink dest
|
(symlink dest
|
||||||
@ -1063,6 +1068,7 @@ in /etc/ganeti/instance-$os for OS."
|
|||||||
(list `("ganeti" ,(ganeti-directory
|
(list `("ganeti" ,(ganeti-directory
|
||||||
(file-storage-file
|
(file-storage-file
|
||||||
(ganeti-configuration-file-storage-paths config))
|
(ganeti-configuration-file-storage-paths config))
|
||||||
|
(ganeti-configuration-hooks config)
|
||||||
(ganeti-configuration-os config)))))
|
(ganeti-configuration-os config)))))
|
||||||
|
|
||||||
(define (debootstrap-os variants)
|
(define (debootstrap-os variants)
|
||||||
|
Loading…
Reference in New Issue
Block a user