diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2023-09-21 16:38:22 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2023-10-01 22:58:20 +0200 |
| commit | 953c65ffdd43c02c934518fb7a1c68542584b223 (patch) | |
| tree | e0fc209ed8fc507e62f7c46a6f66f511f6acff85 /gnu/tests/virtualization.scm | |
| parent | 990d20d4a8685b61d7975a8b24d2e9722194d33f (diff) | |
services: hurd-vm: Implement zero-configuration offloading.
This allows for zero-configuration offloading to a childhurd.
* gnu/services/virtualization.scm (operating-system-with-offloading-account):
New procedure.
(<hurd-vm-configuration>)[offloading?]: New field.
(hurd-vm-disk-image): Define ‘transform’ and use it.
(hurd-vm-activation): Generate SSH key for user ‘offloading’ and add
authorize it via /etc/childhurd/etc/ssh/authorized_keys.d.
(hurd-vm-configuration-offloading-ssh-key)
(hurd-vm-guix-extension): New procedures.
(hurd-vm-service-type): Add GUIX-SERVICE-TYPE extension.
* gnu/tests/virtualization.scm (run-childhurd-test)[import-module?]: New
procedure.
[os]: Add (gnu build install) and its closure to #:import-modules.
[test]: Add “copy-on-write store” and “offloading” tests.
* doc/guix.texi (Virtualization Services): Document it.
Diffstat (limited to 'gnu/tests/virtualization.scm')
| -rw-r--r-- | gnu/tests/virtualization.scm | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/gnu/tests/virtualization.scm b/gnu/tests/virtualization.scm index 599e58edf0a..b79164737b0 100644 --- a/gnu/tests/virtualization.scm +++ b/gnu/tests/virtualization.scm | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #:use-module (guix gexp) | 38 | #:use-module (guix gexp) |
| 39 | #:use-module (guix records) | 39 | #:use-module (guix records) |
| 40 | #:use-module (guix store) | 40 | #:use-module (guix store) |
| 41 | #:use-module (guix modules) | ||
| 41 | #:export (%test-libvirt | 42 | #:export (%test-libvirt |
| 42 | %test-qemu-guest-agent | 43 | %test-qemu-guest-agent |
| 43 | %test-childhurd)) | 44 | %test-childhurd)) |
| @@ -244,11 +245,19 @@ | |||
| 244 | (permit-root-login #t))))))))))) | 245 | (permit-root-login #t))))))))))) |
| 245 | 246 | ||
| 246 | (define (run-childhurd-test) | 247 | (define (run-childhurd-test) |
| 248 | (define (import-module? module) | ||
| 249 | ;; This module is optional and depends on Guile-Gcrypt, do skip it. | ||
| 250 | (and (guix-module-name? module) | ||
| 251 | (not (equal? module '(guix store deduplication))))) | ||
| 252 | |||
| 247 | (define os | 253 | (define os |
| 248 | (marionette-operating-system | 254 | (marionette-operating-system |
| 249 | %childhurd-os | 255 | %childhurd-os |
| 250 | #:imported-modules '((gnu services herd) | 256 | #:imported-modules (source-module-closure |
| 251 | (guix combinators)))) | 257 | '((gnu services herd) |
| 258 | (guix combinators) | ||
| 259 | (gnu build install)) | ||
| 260 | #:select? import-module?))) | ||
| 252 | 261 | ||
| 253 | (define vm | 262 | (define vm |
| 254 | (virtual-machine | 263 | (virtual-machine |
| @@ -373,6 +382,31 @@ | |||
| 373 | (pk 'drv (string-trim-right drv))) | 382 | (pk 'drv (string-trim-right drv))) |
| 374 | drv))) | 383 | drv))) |
| 375 | 384 | ||
| 385 | (test-assert "copy-on-write store" | ||
| 386 | ;; Set up a writable store. The root partition is already an | ||
| 387 | ;; overlayfs, which is not suitable as the bottom part of this | ||
| 388 | ;; additional overlayfs; thus, create a tmpfs for the backing | ||
| 389 | ;; store. | ||
| 390 | ;; TODO: Remove this when <virtual-machine> creates a writable | ||
| 391 | ;; store. | ||
| 392 | (marionette-eval | ||
| 393 | '(begin | ||
| 394 | (use-modules (gnu build install) | ||
| 395 | (guix build syscalls)) | ||
| 396 | |||
| 397 | (mkdir "/run/writable-store") | ||
| 398 | (mount "none" "/run/writable-store" "tmpfs") | ||
| 399 | (mount-cow-store "/run/writable-store" "/backing-store") | ||
| 400 | (system* "df" "-hT")) | ||
| 401 | marionette)) | ||
| 402 | |||
| 403 | (test-equal "offloading" | ||
| 404 | 0 | ||
| 405 | (marionette-eval | ||
| 406 | '(and (file-exists? "/etc/guix/machines.scm") | ||
| 407 | (system* "guix" "offload" "test")) | ||
| 408 | marionette)) | ||
| 409 | |||
| 376 | (test-end)))) | 410 | (test-end)))) |
| 377 | 411 | ||
| 378 | (gexp->derivation "childhurd-test" test)) | 412 | (gexp->derivation "childhurd-test" test)) |
