mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-05-26 11:01:48 +02:00
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>
This commit is contained in:
committed by
Ludovic Courtès
parent
0c21ec1c79
commit
f634a0baab
@@ -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)))
|
||||
@@ -847,6 +852,47 @@ given QEMU package."
|
||||
compiled for other architectures using QEMU and the @code{binfmt_misc}
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user