From unknown Sat Jun 21 10:29:13 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#51573] [PATCH] gnu: virtualization: Add qemu-guest-agent service. Resent-From: Timotej Lazar Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 02 Nov 2021 19:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51573 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51573@debbugs.gnu.org Cc: Timotej Lazar X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.163588008525750 (code B ref -1); Tue, 02 Nov 2021 19:09:01 +0000 Received: (at submit) by debbugs.gnu.org; 2 Nov 2021 19:08:05 +0000 Received: from localhost ([127.0.0.1]:38108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhz8f-0006hG-Fm for submit@debbugs.gnu.org; Tue, 02 Nov 2021 15:08:05 -0400 Received: from lists.gnu.org ([209.51.188.17]:33814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhz8c-0006h7-3T for submit@debbugs.gnu.org; Tue, 02 Nov 2021 15:08:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhz8c-0003I9-0Y for guix-patches@gnu.org; Tue, 02 Nov 2021 15:08:02 -0400 Received: from araneo.si ([2001:15c0:2110:3400::2]:34010) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhz8X-00043t-6D for guix-patches@gnu.org; Tue, 02 Nov 2021 15:08:01 -0400 Received: from araneo.si (localhost.lan [127.0.0.1]) by araneo.si (OpenSMTPD) with ESMTP id 5195dcda for ; Tue, 2 Nov 2021 19:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=araneo.si; h=from:to:cc :subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=20180623; bh=IcfyZU+1DkYBNqIuF9H/f yztzNU=; b=QN0kcAer94kvOACsoNtDmYvHNQzDKNfhwcsIZABIYDODjBQpRckYv fZAT1XqQvgkayNlOWQCXHp3oc7clZFZh47TmXLSQI+KQDUEa4L22sLEfoy137BH7 1952b9Re0xkxNGVSKTYKdAR6jatoUndDfEHlc0Mrd3d2MsOCGgcdVMh2Jjx7X7Yd LnrVgK0eMI00M7y7nECtGrISZ/Q+b35bYMTRkcxBClORnGYD9BMTHeMAdGC8Fm4I 62D8VbpX1WNFOWHaB3l7b6OnTuADiblpCwHCRTMSboOmqQHDW39anhIYLSnDHXZ3 w/QIVEsuFr2xCpxkcl7jLM9GuRuTB00tw== Received: by araneo.si (OpenSMTPD) with ESMTPSA id d9e6bd80 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 2 Nov 2021 19:07:51 +0000 (UTC) From: Timotej Lazar Date: Tue, 2 Nov 2021 20:06:32 +0100 Message-Id: <20211102190629.14471-1-timotej.lazar@araneo.si> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2001:15c0:2110:3400::2; envelope-from=timotej.lazar@araneo.si; helo=araneo.si X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) * gnu/services/virtualization.scm (): New record. (qemu-guest-agent-shepherd-service): New procedure. (qemu-guest-agent-service-type): New variable. * doc/guix.texi (Virtualization Services): Document it. --- doc/guix.texi | 47 ++++++++++++++++++++++++++++++++ gnu/services/virtualization.scm | 48 ++++++++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index ea1973f02c..5e6a6dea0e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -30042,6 +30042,53 @@ Return the name of @var{platform}---a string such as @code{"arm"}. @end deffn +@subsubheading QEMU guest agent + +@cindex emulation + +The QEMU guest agent provides control over the emulated system to the +host. The @code{qemu-guest-agent} service runs the agent on Guix +guests. To control the agent from the host, open a socket by invoking +@code{qemu} with the following arguments: + +@example +qemu-system-x86_64 \ + -chardev socket,path=/tmp/qga.sock,server=on,wait=off,id=qga0 \ + -device virtio-serial \ + -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \ + ... +@end example + +This creates a socket at @file{/tmp/qga.sock} on the host. Once the +guest agent is running, you can issue commands with @code{socat}: + +@example +$ guix shell socat -- socat unix-connect:/tmp/qga.sock stdio +@{"execute": "guest-get-host-name"@} +@{"return": @{"host-name": "guix"@}@} +@end example + +See @url{https://wiki.qemu.org/Features/GuestAgent,QEMU guest agent +documentation} for more options and commands. + +@defvr {Scheme Variable} qemu-guest-agent-service-type +Service type for the QEMU guest agent service. +@end defvr + +@deftp {Data Type} qemu-guest-agent-configuration +Configuration for the @code{qemu-guest-agent} service. + +@table @asis +@item @code{qemu} (default: @code{qemu-minimal}) +The qemu package to use. + +@item @code{device} (default: @code{""}) +Path to device or socket the agent uses to communicate with the host. +If empty, QEMU uses a default path. +@end table +@end deftp + + @subsubheading The Hurd in a Virtual Machine @cindex @code{hurd} 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 ;;; Copyright © 2018, 2020, 2021 Ludovic Courtès ;;; Copyright © 2020,2021 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2021 Timotej Lazar ;;; ;;; This file is part of GNU Guix. ;;; @@ -82,7 +83,11 @@ (define-module (gnu services virtualization) 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 @@ (define qemu-binfmt-service-type 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 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. -- 2.33.1 From unknown Sat Jun 21 10:29:13 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Timotej Lazar Subject: bug#51573: closed (Re: bug#51573: [PATCH] gnu: virtualization: Add qemu-guest-agent service.) Message-ID: References: <877ddddmjq.fsf@gnu.org> <20211102190629.14471-1-timotej.lazar@araneo.si> X-Gnu-PR-Message: they-closed 51573 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 51573@debbugs.gnu.org Date: Fri, 12 Nov 2021 22:42:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1636756922-32737-1" This is a multi-part message in MIME format... ------------=_1636756922-32737-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #51573: [PATCH] gnu: virtualization: Add qemu-guest-agent service. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 51573@debbugs.gnu.org. --=20 51573: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D51573 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1636756922-32737-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 51573-done) by debbugs.gnu.org; 12 Nov 2021 22:41:40 +0000 Received: from localhost ([127.0.0.1]:46131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mlfEp-0008VO-Iq for submit@debbugs.gnu.org; Fri, 12 Nov 2021 17:41:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34904) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mlfEn-0008V7-Rg for 51573-done@debbugs.gnu.org; Fri, 12 Nov 2021 17:41:38 -0500 Received: from [2001:470:142:3::e] (port=40498 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlfEi-0004oi-8Z; Fri, 12 Nov 2021 17:41:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=8DWp3Erff+SmoeDXeRBPSz3Sm8GXJa1SAIRCJ2i75M4=; b=RWGgK1nnPxn3Oe2tKCgf X0TBG65xEkXeSJ815TEjwLvG1gbxswzH/40An85SVSMh1bZOQ1873xxnF2qgY7wRBrEMj4I35yi1z 66GSgteHNvySQxOGudaRX4fWB3hT8cRkqQt6iFsT3hz+hE5OqKsf/SdKwJSu1GIff6r/gp5zVUuE4 C/Y7DrwlmsSC0AiyLKX9OL9Sl+z4npUJ51AVRiEP+8NcGugbmmz3liRpMT+f4N2Gegp2Oawz1PxZl H4E+CRpApcQ2a8dadj0dCqMGT+Og+fEVJHi4sNJQjCZWkl894ui/xyP+p8xQ74NV8dEzw+lnEG9KB qtn22uRAXoCs7A==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:52826 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlfEg-0000Fx-QU; Fri, 12 Nov 2021 17:41:31 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Timotej Lazar Subject: Re: bug#51573: [PATCH] gnu: virtualization: Add qemu-guest-agent service. References: <20211102190629.14471-1-timotej.lazar@araneo.si> Date: Fri, 12 Nov 2021 23:41:29 +0100 In-Reply-To: <20211102190629.14471-1-timotej.lazar@araneo.si> (Timotej Lazar's message of "Tue, 2 Nov 2021 20:06:32 +0100") Message-ID: <877ddddmjq.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 51573-done Cc: 51573-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Timotej Lazar skribis: > * gnu/services/virtualization.scm (): New > record. > (qemu-guest-agent-shepherd-service): New procedure. > (qemu-guest-agent-service-type): New variable. > * doc/guix.texi (Virtualization Services): Document it. Nice. Do you think we could have a simple test under (gnu tests virtualization) for this? Applied with the cosmetic changes below. Thanks! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/doc/guix.texi b/doc/guix.texi index c0dfb2e5e2..7e54b5f75e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -30060,14 +30060,14 @@ Return the name of @var{platform}---a string such as @code{"arm"}. @end deffn -@subsubheading QEMU guest agent +@subsubheading QEMU Guest Agent @cindex emulation The QEMU guest agent provides control over the emulated system to the host. The @code{qemu-guest-agent} service runs the agent on Guix guests. To control the agent from the host, open a socket by invoking -@code{qemu} with the following arguments: +QEMU with the following arguments: @example qemu-system-x86_64 \ @@ -30098,11 +30098,11 @@ Configuration for the @code{qemu-guest-agent} service. @table @asis @item @code{qemu} (default: @code{qemu-minimal}) -The qemu package to use. +The QEMU package to use. @item @code{device} (default: @code{""}) -Path to device or socket the agent uses to communicate with the host. -If empty, QEMU uses a default path. +File name of the device or socket the agent uses to communicate with the +host. If empty, QEMU uses a default file name. @end table @end deftp --=-=-=-- ------------=_1636756922-32737-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 2 Nov 2021 19:08:05 +0000 Received: from localhost ([127.0.0.1]:38108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhz8f-0006hG-Fm for submit@debbugs.gnu.org; Tue, 02 Nov 2021 15:08:05 -0400 Received: from lists.gnu.org ([209.51.188.17]:33814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhz8c-0006h7-3T for submit@debbugs.gnu.org; Tue, 02 Nov 2021 15:08:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhz8c-0003I9-0Y for guix-patches@gnu.org; Tue, 02 Nov 2021 15:08:02 -0400 Received: from araneo.si ([2001:15c0:2110:3400::2]:34010) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhz8X-00043t-6D for guix-patches@gnu.org; Tue, 02 Nov 2021 15:08:01 -0400 Received: from araneo.si (localhost.lan [127.0.0.1]) by araneo.si (OpenSMTPD) with ESMTP id 5195dcda for ; Tue, 2 Nov 2021 19:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=araneo.si; h=from:to:cc :subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=20180623; bh=IcfyZU+1DkYBNqIuF9H/f yztzNU=; b=QN0kcAer94kvOACsoNtDmYvHNQzDKNfhwcsIZABIYDODjBQpRckYv fZAT1XqQvgkayNlOWQCXHp3oc7clZFZh47TmXLSQI+KQDUEa4L22sLEfoy137BH7 1952b9Re0xkxNGVSKTYKdAR6jatoUndDfEHlc0Mrd3d2MsOCGgcdVMh2Jjx7X7Yd LnrVgK0eMI00M7y7nECtGrISZ/Q+b35bYMTRkcxBClORnGYD9BMTHeMAdGC8Fm4I 62D8VbpX1WNFOWHaB3l7b6OnTuADiblpCwHCRTMSboOmqQHDW39anhIYLSnDHXZ3 w/QIVEsuFr2xCpxkcl7jLM9GuRuTB00tw== Received: by araneo.si (OpenSMTPD) with ESMTPSA id d9e6bd80 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 2 Nov 2021 19:07:51 +0000 (UTC) From: Timotej Lazar To: guix-patches@gnu.org Subject: [PATCH] gnu: virtualization: Add qemu-guest-agent service. Date: Tue, 2 Nov 2021 20:06:32 +0100 Message-Id: <20211102190629.14471-1-timotej.lazar@araneo.si> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2001:15c0:2110:3400::2; envelope-from=timotej.lazar@araneo.si; helo=araneo.si X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: Timotej Lazar X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) * gnu/services/virtualization.scm (): New record. (qemu-guest-agent-shepherd-service): New procedure. (qemu-guest-agent-service-type): New variable. * doc/guix.texi (Virtualization Services): Document it. --- doc/guix.texi | 47 ++++++++++++++++++++++++++++++++ gnu/services/virtualization.scm | 48 ++++++++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index ea1973f02c..5e6a6dea0e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -30042,6 +30042,53 @@ Return the name of @var{platform}---a string such as @code{"arm"}. @end deffn +@subsubheading QEMU guest agent + +@cindex emulation + +The QEMU guest agent provides control over the emulated system to the +host. The @code{qemu-guest-agent} service runs the agent on Guix +guests. To control the agent from the host, open a socket by invoking +@code{qemu} with the following arguments: + +@example +qemu-system-x86_64 \ + -chardev socket,path=/tmp/qga.sock,server=on,wait=off,id=qga0 \ + -device virtio-serial \ + -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \ + ... +@end example + +This creates a socket at @file{/tmp/qga.sock} on the host. Once the +guest agent is running, you can issue commands with @code{socat}: + +@example +$ guix shell socat -- socat unix-connect:/tmp/qga.sock stdio +@{"execute": "guest-get-host-name"@} +@{"return": @{"host-name": "guix"@}@} +@end example + +See @url{https://wiki.qemu.org/Features/GuestAgent,QEMU guest agent +documentation} for more options and commands. + +@defvr {Scheme Variable} qemu-guest-agent-service-type +Service type for the QEMU guest agent service. +@end defvr + +@deftp {Data Type} qemu-guest-agent-configuration +Configuration for the @code{qemu-guest-agent} service. + +@table @asis +@item @code{qemu} (default: @code{qemu-minimal}) +The qemu package to use. + +@item @code{device} (default: @code{""}) +Path to device or socket the agent uses to communicate with the host. +If empty, QEMU uses a default path. +@end table +@end deftp + + @subsubheading The Hurd in a Virtual Machine @cindex @code{hurd} 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 ;;; Copyright © 2018, 2020, 2021 Ludovic Courtès ;;; Copyright © 2020,2021 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2021 Timotej Lazar ;;; ;;; This file is part of GNU Guix. ;;; @@ -82,7 +83,11 @@ (define-module (gnu services virtualization) 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 @@ (define qemu-binfmt-service-type 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 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. -- 2.33.1 ------------=_1636756922-32737-1--