diff options
author | Timotej Lazar <timotej.lazar@araneo.si> | 2021-11-02 20:06:32 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2021-11-12 23:41:44 +0100 |
commit | f634a0baab85454a6feac25e29905f564b276c9e (patch) | |
tree | 8de5efefdf9de51504fe2217533f7cb9e3910927 /gnu/services | |
parent | 0c21ec1c7915bdc08c68c66eba411cf533d4e503 (diff) | |
download | guix-f634a0baab85454a6feac25e29905f564b276c9e.tar.gz |
services: Add qemu-guest-agent service.
* gnu/services/virtualization.scm (<qemu-guest-agent-configuration>): New record. (qemu-guest-agent-shepherd-service): New procedure. (qemu-guest-agent-service-type): New variable. * doc/guix.texi (Virtualization Services): Document it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/services')
-rw-r--r-- | gnu/services/virtualization.scm | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm index bca5f56b87..1a5744ffbf 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2017 Ryan Moe <ryan.moe@gmail.com> ;;; Copyright © 2018, 2020, 2021 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2020,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> +;;; Copyright © 2021 Timotej Lazar <timotej.lazar@araneo.si> ;;; ;;; This file is part of GNU Guix. ;;; @@ -82,7 +83,11 @@ qemu-binfmt-configuration qemu-binfmt-configuration? - qemu-binfmt-service-type)) + qemu-binfmt-service-type + + qemu-guest-agent-configuration + qemu-guest-agent-configuration? + qemu-guest-agent-service-type)) (define (uglify-field-name field-name) (let ((str (symbol->string field-name))) @@ -849,6 +854,47 @@ functionality of the kernel Linux."))) ;;; +;;; QEMU guest agent service. +;;; + +(define-configuration qemu-guest-agent-configuration + (qemu + (package qemu-minimal) + "QEMU package.") + (device + (string "") + "Path to device or socket used to communicate with the host. If not +specified, the QEMU default path is used.")) + +(define qemu-guest-agent-shepherd-service + (match-lambda + (($ <qemu-guest-agent-configuration> qemu device) + (list + (shepherd-service + (provision '(qemu-guest-agent)) + (documentation "Run the QEMU guest agent.") + (start #~(make-forkexec-constructor + `(,(string-append #$qemu "/bin/qemu-ga") "--daemon" + "--pidfile=/var/run/qemu-ga.pid" + "--statedir=/var/run" + ,@(if #$device + (list (string-append "--path=" #$device)) + '())) + #:pid-file "/var/run/qemu-ga.pid" + #:log-file "/var/log/qemu-ga.log")) + (stop #~(make-kill-destructor))))))) + +(define qemu-guest-agent-service-type + (service-type + (name 'qemu-guest-agent) + (extensions + (list (service-extension shepherd-root-service-type + qemu-guest-agent-shepherd-service))) + (default-value (qemu-guest-agent-configuration)) + (description "Run the QEMU guest agent."))) + + +;;; ;;; Secrets for guest VMs. ;;; |