From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id cImAJgncfmc6RwEA62LTzQ:P1 (envelope-from ) for ; Wed, 08 Jan 2025 20:11:53 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id cImAJgncfmc6RwEA62LTzQ (envelope-from ) for ; Wed, 08 Jan 2025 21:11:53 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=ag0ZuyEa; dkim=fail ("body hash did not verify") header.d=hallsby.com header.s=google header.b="Qm/u4lBZ"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1736367113; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=2MPRpfGZq5EwI/rWvlyMFaERylyU9TIAzNruDcULYlE=; b=cRpcBEy4bDbE/Abm8ZVq4kNK+0k7RnUFllsoKzgNh7Njqb595s0HaR6XspeUSkf5i8Pdyz fSlhqRSfA8ZR4u+q0qrOMChaqCB+Pmhw+teRGaXiD7uXpkLfng5eploS8an0R1K+pQ0Wh2 OGRC5VozXuhJ/jPhbD/CjZypnXSvALlmUj0tUMNShIEZ7CWq89xewSPCeBblVd4eUkG94x Lc01/+buyNAZCcjRV9LoNmW/A2A09VoON4+Pc3kGzf8pO4kjE41LNBUAXkV1YZnkvLZwAK W56q1mIpyCCExkgeJpGfdiXU/SAHNtOKMrfvvGg5cR8/nLHhLpHp3gCZSL5LeQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=ag0ZuyEa; dkim=fail ("body hash did not verify") header.d=hallsby.com header.s=google header.b="Qm/u4lBZ"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1736367113; a=rsa-sha256; cv=none; b=Rp0pOmVjYfs/9kc8Qs1NxiMbxb2UdPp58advXBtksDLuMiIP81ZzR/jO5Qm9nEfC8Y1ngZ VORA0N1D7e+qAsws702KcnKyVFEZe0FOlMge31a33M8xqlDbK4wzOnhlq08PV/SSkGsomB I9VH+TwFgzadvSgQYukI8VSisijr6yc9VBYchcaU+GxYmvpw7Lz5+5YTAHHqUO/eo6d997 qNx2PJ2XEIXe++QHVk7bntQ92ze/MJIgoSVJ0FSmUGC72dQXG1fcs9YwKSF4m5waGTVB5U GpZTTnguiBVtlPesWiw/PrRZS/fx8ev/tGzhiloBinxKvQKFy2LQuEBECpWecQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 03A4618D85 for ; Wed, 08 Jan 2025 21:11:52 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVcOf-0003zI-1X; Wed, 08 Jan 2025 15:11:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVcOO-0003nF-Bz for guix-patches@gnu.org; Wed, 08 Jan 2025 15:11:11 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVcON-0003Ki-31; Wed, 08 Jan 2025 15:11:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=8al9n/9z98ESk4P6kMa6R8/5phOstQcIlC/YejfmFA4=; b=ag0ZuyEapYpSTEQHF3r1jAosdvVSj45+aYXKEjTnPYQysFKKea1PQ/07Ofj25U+sEDKDAZychcZmUnT60Qfd1inSYSg9NSfJJ/7SLNL/wEFBGrB6ZLS5s4R+TAHmyOvxCICh/ItcT9LHr9zObESej5+eOU5cWmnQ6EHFSJK/A6UVQuPoRye/u6TzW5g1lXUBHPkATJzZmxQxwSc0efT0II/clZl/XUq8/fQRk2pOekZTilZwEgb376was1H6TsIJbvqqx5MWwTQCePJihEO/oqy0/2zrC2AF0kGotGtdBDK86s9qqTYMnuz1NjNGLFMZI/97dtNDf6jP1tMqNjvM7g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tVcOM-0000b9-U1; Wed, 08 Jan 2025 15:11:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#72249] [PATCH 2/2] services: Add xe-guest-utilities-service-type. Resent-From: Karl Hallsby Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Wed, 08 Jan 2025 20:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72249 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 72249@debbugs.gnu.org Cc: Karl Hallsby , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 72249-submit@debbugs.gnu.org id=B72249.17363670462263 (code B ref 72249); Wed, 08 Jan 2025 20:11:02 +0000 Received: (at 72249) by debbugs.gnu.org; 8 Jan 2025 20:10:46 +0000 Received: from localhost ([127.0.0.1]:49094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tVcO5-0000aQ-PF for submit@debbugs.gnu.org; Wed, 08 Jan 2025 15:10:46 -0500 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:45296) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tVcO2-0000Zx-0d for 72249@debbugs.gnu.org; Wed, 08 Jan 2025 15:10:42 -0500 Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-844eac51429so10053039f.2 for <72249@debbugs.gnu.org>; Wed, 08 Jan 2025 12:10:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hallsby.com; s=google; t=1736367036; x=1736971836; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8al9n/9z98ESk4P6kMa6R8/5phOstQcIlC/YejfmFA4=; b=Qm/u4lBZ6fTC04c/3lLGwDs3kcqqO4qJHFa6QCY1SaxygBmVlwOK8ODiF9xxDmJPuH zbEK1TggFqBbI+tNdtPo8i+x3DqY0SwDZd1d+n1w6K+HO92Q3w+JIE3UlTvJBdis8phq 0ex+D5K4cI3rub1Zr+dnORx/DpZZMAL1v2hQZFqouNp6SDyetY5dmnpSvlrMCgGd2XCM zNY5JCf9mFI/7LKs/nW8Cg5/Orhrm3RIzumgLaIwNdcofpxkjKFwrSYq4YgRLaopH3C1 949DmRg0oUD7P7DHyzkb/ISKRCofhkzDTOwVRPo3RVSYiMw/CNV7Ig0EzJlz3zqRBP3t Fqxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736367036; x=1736971836; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8al9n/9z98ESk4P6kMa6R8/5phOstQcIlC/YejfmFA4=; b=p3ywhrs81uFo35LKz/3tQoQuox/nHmz7SNBA2rU/oq+BlRGvGL664cEXZAjNqh71sO fftRONE0NfDxuXc/SRwdeZzQNNLqm+PHC1a5rKa9MjnqPk081zrLJq1/kbY/y5W4K3Kb SPsKQxV9rH+xKqCZbxTwHq0atcUPHKVLplFM0YkyGA3kNigRLnNQr+T9m5Of6/K8Twz/ nmgFRTj6CH4Do8+Kh5SbMLTzZPl17vBUCvGxzg6Eg0y9yZn+m86+oBhAqSZGIb/epor+ FBmieCkBlY7b9eBG1Dg14md/c6VRVwwhHQ3d9SXqn+geQ421jNHfyy1bYqVx3R/CRoL/ 21UQ== X-Gm-Message-State: AOJu0YxHzIdiyX92d3h299MfT4kjw0KR3J9v5Hzkefr4MIQByIjVWOfz qjbVMAwYUdwSAdf+T/85xorjliiuSRk165zPvXQUysinK4X/5TVCadRdhEW9DwA5dxl5U5N1QFU = X-Gm-Gg: ASbGnctZgrKUrLV+7WgyPJG+G1mgjv67XVcBjB8Sg/R+J0e4gKJyxbEnpXBddm2j1+3 9VwO5AawtYzFXgRtUta/WRBVAf+e+4edGxCJJ5DbgnMv7fXQD6zG9/YdSveHkkp6TuzH6YLF6Iy yZ8pq7nyUNE/5GCIRNOUMkI/l54zBTzOYpS1z7QVgNvejAkat0ikmYNvfwi1gXA2IW5Hstuc5/P XOQ/zxqtnEBdD35MdcotzHDZz1WuP5Qjz1YCpsoO/A43S3Ia8IpgIVcdvc5yA== X-Google-Smtp-Source: AGHT+IELV2e65PAyCwd3N4iMUxaJFlRaYlJhomZjCfTtKyfBpqSnT5pi+lBOai3gKfBg4J5TvpyXDg== X-Received: by 2002:a05:6e02:87:b0:3a7:6e72:fbb3 with SMTP id e9e14a558f8ab-3ce3a86a52amr36433965ab.4.1736367035910; Wed, 08 Jan 2025 12:10:35 -0800 (PST) Received: from Karl-Desktop.raven ([207.237.222.72]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e68c1df14csm10674260173.125.2025.01.08.12.10.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 12:10:35 -0800 (PST) Date: Wed, 8 Jan 2025 14:10:26 -0600 Message-ID: <05dbe98e7be3b45ddbf4a49df643e35333df78e7.1736366732.git.karl@hallsby.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <6920fcb2b7edd619b323c7f70d076a7a73ab0463.1736366732.git.karl@hallsby.com> References: <6920fcb2b7edd619b323c7f70d076a7a73ab0463.1736366732.git.karl@hallsby.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Karl Hallsby X-ACL-Warn: , Karl Hallsby via Guix-patches From: Karl Hallsby via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -1.48 X-Spam-Score: -1.48 X-Migadu-Queue-Id: 03A4618D85 X-TUID: Ha83JsXOROpV * gnu/services/virtualization.scm (xe-guest-utilities-configuration, xe-guest-utilities-service-type): New variables. * doc/guix.texi: Document them. Change-Id: Ife4e79fa6d1a9d5a21bf7479488884f2a5cf8d56 --- doc/guix.texi | 37 +++++++++++++++ gnu/services/virtualization.scm | 81 ++++++++++++++++++++++++++++++++- 2 files changed, 117 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index f7b7569887..ee827717a1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -37328,6 +37328,43 @@ Virtualization Services @end table @end deftp +@subsubheading Xen Guest Agent + +@cindex xen +@cindex xen guest agent + +The Xen guest agent allows a Xen host to control the emulated system. +The @code{xe-guest-utilities} service runs the agent on Guix guests. + +@quotation Note +The default Linux-libre kernel that Guix ships already enables the +necessary paravirtualization features for a guest. There is nothing you +need to do for the guest to support Xen's paravirtualization features. + +The guest utilities are used to have the guest report information +@emph{back} to the virtualizing host and support tasks that require +cooperation between host and guest, like CPU hotplugging. +@end quotation + +@defvar xe-guest-utilities-service-type +Service type for the Xen guest utilities service. +@end defvar + +@deftp {Data Type} xe-guest-utilities-configuration +Configuration for the @code{xe-guest-utilities} service. + +@table @asis +@item @code{package} (default: @code{xe-guest-utilities}) +The Xen guest utilities package to use. + +@item @code{pid-file} (default: @code{"/var/run/xe-daemon.pid"}) +Path to the file holding the PID of xe-deamon. + +@item @code{log-file} (default: @code{"/var/log/xe-guest-utilities.log"}) +Path to @code{xe-guest-utilities} log file. +@end table +@end deftp + @anchor{build-vm} @subsubheading Virtual Build Machines diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm index c32c47484c..874abcd73f 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm @@ -33,6 +33,9 @@ (define-module (gnu services virtualization) #:autoload (gnu packages gnupg) (guile-gcrypt) #:use-module (gnu packages package-management) #:use-module (gnu packages ssh) + #:use-module (gnu packages base) + #:use-module (gnu packages gawk) + #:use-module (gnu packages linux) #:use-module (gnu packages virtualization) #:use-module (gnu services base) #:use-module (gnu services configuration) @@ -107,7 +110,10 @@ (define-module (gnu services virtualization) qemu-guest-agent-configuration qemu-guest-agent-configuration? - qemu-guest-agent-service-type)) + qemu-guest-agent-service-type + + xe-guest-utilities-configuration + xe-guest-utilities-service-type)) (define (uglify-field-name field-name) (let ((str (symbol->string field-name))) @@ -1004,6 +1010,79 @@ (define qemu-guest-agent-service-type (default-value (qemu-guest-agent-configuration)) (description "Run the QEMU guest agent."))) + +;;; +;;; Guest agent for VMs running under Xen +;;; +(define-configuration/no-serialization xe-guest-utilities-configuration + (package + (package xe-guest-utilities) + "Xen guest management utilities package.") + (pid-file + (string "/var/run/xe-daemon.pid") + "Path to the file holding the PID of xe-deamon.") + (log-file + (string "/var/log/xe-guest-utilties.log") + "Path to xe-guest-utilities log file.")) + +(define (generate-xe-guest-utilities-documentation) + "Generate documentation for xe-guest-utilities-configuration fields" + (generate-documentation + `((xe-guest-utilities-configuration ,xe-guest-utilities-configuration-fields)) + 'xe-guest-utilities-configuration)) + +(define (xe-guest-utilities-shepherd-service config) + (let ((xe-guest-utils (xe-guest-utilities-configuration-package config)) + (pid-file (xe-guest-utilities-configuration-pid-file config)) + (log-file (xe-guest-utilities-configuration-log-file config))) + (list + (shepherd-service + (provision '(xen-guest-agent)) + (requirement '(networking user-processes udev)) + (documentation "Run the Xen guest management agent.") + (start + #~(lambda _ + (let ((pid (make-forkexec-constructor + (list + #$(file-append xe-guest-utils + "/sbin/xe-daemon") + "-p" #$pid-file) + #:log-file #$log-file + #:pid-file #$pid-file + #:environment-variables + (list (string-append + "PATH=" + #$(file-append xe-guest-utils "/bin") ":" + ;; logger + #$(file-append inetutils "/bin")))))) + ;; Run xe-linux-distribution script before starting the actual + ;; daemon. The script collects some basic system information that + ;; is shared back to the Xen host. + (system* #$(file-append xe-guest-utils "/sbin/xe-linux-distribution") + "/var/cache/xe-linux-distribution") + ;; Finally, start and return the PID made by + ;; make-forkexec-constructor. + pid))) + (stop #~(make-kill-destructor)))))) + +(define (xe-guest-utilities-udev-rules-service config) + (let ((guest-utils (xe-guest-utilities-configuration-package config))) + (list + (file->udev-rule + "z10_xen-vcpu-hotplug.rules" + (file-append guest-utils "/lib/udev/rules.d/z10_xen-vcpu-hotplug.rules"))))) + +(define xe-guest-utilities-service-type + (service-type + (name 'xe-guest-utilities) + (extensions + (list (service-extension shepherd-root-service-type + xe-guest-utilities-shepherd-service) + (service-extension udev-service-type + xe-guest-utilities-udev-rules-service))) + (default-value (xe-guest-utilities-configuration)) + (description "Run the Xen guest management utilities."))) + ;;; ;;; Secrets for guest VMs. -- 2.46.0