summaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-03-18 11:08:39 +0900
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-03-27 21:21:06 +0900
commit2eb22e3d0f8013e438813b1a2c5f8b1e020fcde2 (patch)
treec0e06761cb097c501daeb019e9e9c435d96ce733 /gnu/tests
parent0e151a865d223cb14ac997288cb4386225fa502f (diff)
services: libvirt: Add UEFI firmware support.
This makes libvirt able to boot images that require a UEFI bootloader, with the available firmwares exposed to libvirt made configurable via a new configuration field. For more background on the problem this fixes, see the same issue that was reported in NixOS (see: https://github.com/NixOS/nixpkgs/issues/115996). * gnu/services/virtualization.scm: (list-of-file-likes?): New predicate. (libvirt-configuration): [firmwares]: New field. (/etc/qemu/firmware): New procedure. (libvirt-service-type): Extend the etc-service-type with it. (generate-libvirt-documentation): Delete obsolete procedure. * doc/guix.texi: Re-generate doc. * gnu/tests/virtualization.scm (run-libvirt-test): Augment memory from 256 to 512 MiB. Test it. Series-to: 77110@debbugs.gnu.org Change-Id: I40694964405f13681520bf1e28b7365b0200d8f7
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/virtualization.scm33
1 files changed, 32 insertions, 1 deletions
diff --git a/gnu/tests/virtualization.scm b/gnu/tests/virtualization.scm
index a3c9c4014b3..e08f66eb281 100644
--- a/gnu/tests/virtualization.scm
+++ b/gnu/tests/virtualization.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
;;; Copyright © 2022 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2025 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -69,7 +70,8 @@
(define vm
(virtual-machine
(operating-system os)
- (port-forwardings '())))
+ (port-forwardings '())
+ (memory-size 512)))
(define test
(with-imported-modules '((gnu build marionette))
@@ -135,6 +137,35 @@
"-c" "qemu:///system" "net-start" "default"))
marionette))
+ (test-assert "configured firmwares are available to libvirt"
+ (marionette-eval
+ '(begin
+ (use-modules (ice-9 popen)
+ (ice-9 textual-ports)
+ (srfi srfi-1)
+ (srfi srfi-26))
+ (let* ((conf-firmwares (list #$@(libvirt-configuration-firmwares
+ (libvirt-configuration))))
+ (virsh #$(file-append libvirt "/bin/virsh"))
+ (input-pipe (open-pipe*
+ OPEN_READ
+ virsh "-c" "qemu:///system"
+ "domcapabilities" "--xpath"
+ "/domainCapabilities/os/loader/value/text()"))
+ (output (get-string-all input-pipe))
+ (found-firmwares (string-split (string-trim-both output)
+ #\newline)))
+ (close-pipe input-pipe)
+ ;; Check that every configured firmware package is covered
+ ;; by at least by one firmware file available to libvirt.
+ (every (lambda (conf-firmware)
+ ;; The firmwares listed by virsh contains their
+ ;; full file names, not just their package output.
+ (any (cut string-prefix? conf-firmware <>)
+ found-firmwares))
+ conf-firmwares)))
+ marionette))
+
(test-end))))
(gexp->derivation "libvirt-test" test))