From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id CE1FBgfGgGekFgAA62LTzQ:P1 (envelope-from ) for ; Fri, 10 Jan 2025 07:02:31 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id CE1FBgfGgGekFgAA62LTzQ (envelope-from ) for ; Fri, 10 Jan 2025 08:02:31 +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=rpDwSu7F; dkim=fail ("body hash did not verify") header.d=hallsby.com header.s=google header.b=VIcxdsHR; 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=1736492551; 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=Jv8dHRGzm6HeRUhwTT/y8k+5Zb13w8zNRA8YYPWK+Sw=; b=lKLT2qIuigpF0NYbxZrSACLDGnrntmtL6xZA6H+WQ6BW2y9OT13BhxCts/FU4cJI4xeNiQ HTIIKFK1tQEIAiXn0tEteO4BoN0DyaqCKcS+65BvYNkoyWxSWGcgD9xFs+CeCntVe8xCXR Y0xlk6tGGF9l0Vk5QbWoGw0W7j9a0AWfTSv14ItAKx79VCSAbcD7mNU8/ZFYwVrRXfkFfJ Agw6BYOT9HZGdkJJghsru3P2f6hJRpbXFL6DlxHYPLMV9yWXLbXZmshvib00qtaLPBS9GT FR9FYglYtGMk1Mbtl03ZWfySHdTL8T6wRCx4O3EfgfuN+IWhPDWLB4ZIYKFI+w== 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=rpDwSu7F; dkim=fail ("body hash did not verify") header.d=hallsby.com header.s=google header.b=VIcxdsHR; 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=1736492551; a=rsa-sha256; cv=none; b=cOXTzU75x5V9a6DE37FleimzKkjaUU+k+VLP8mG9M6f02BGG7Oq9+Uc5xJG2Bf53VQi8Ro 4sitt94cNrDfKieAyTTngTFESLw7JczcSdviuy+mFvwBqBLgGY2HbwwnicwXH8Ec9DXtP7 ku6doqWerK/lWREKsxlv+YaMFuFH7RgOwMjVQcBqVRKQ8HSKG1PFm3SoSGh5sxNNKwFZ/T i9oiB4Z48GYEbc0+WA8QSJMG8sivSpxVopXdri+229iETqoh0q7URXbidcu0KjpmZBIgwu b45Wsi+DvBpc17W6wFySvyXON2GwR9VIleuaUeDnmw4SC99DmxW1QBVxo7KFZA== 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 BFFEF7AF4F for ; Fri, 10 Jan 2025 08:02:30 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tW91x-0006Ma-BP; Fri, 10 Jan 2025 02:02:06 -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 1tW91v-0006M6-7h for guix-patches@gnu.org; Fri, 10 Jan 2025 02:02:03 -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 1tW91u-0005aG-56; Fri, 10 Jan 2025 02:02:02 -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:Date:From:To:In-Reply-To:References:Subject; bh=Z0EJee9vFjm9IXj8noabH1VxgucUslavG+ol44X00ZY=; b=rpDwSu7FHSp8eKghfE6kNRtyEcmHT8rxgrAvOmxRKhzRWdpPLZv+iqpdL64AyF5Srl74Wm3WETyNroZQGiVe15r+dTKjFdVzh0dzKUJgB1dD+eOk4NkTYR1dxFr2qume61SpPuynzlhgapdpNXTyn3f7O6y1yXDkxwIjbTxFySBxURNn5q+ZSE8tLlI3Mrrvcp5fVvYwMNrpXFnk977Aj2HotmeSD9bpS/6lQmHNXL1RkTgPB0Y9NhVPesr+iZVLCaOTVYOFpxIt4x7DhJbzAB7BISvbQ1ChsfyS+3I8BMnMv1+GJkpZBtQ/vLvuAMx02cOHBZXEuLkcw0jKu5RJvA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tW91t-0000Cv-Lq; Fri, 10 Jan 2025 02:02:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#72249] [PATCH] services: Add xe-guest-utilities-service-type. References: In-Reply-To: Resent-From: Karl Hallsby Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Fri, 10 Jan 2025 07:02:01 +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.1736492484748 (code B ref 72249); Fri, 10 Jan 2025 07:02:01 +0000 Received: (at 72249) by debbugs.gnu.org; 10 Jan 2025 07:01:24 +0000 Received: from localhost ([127.0.0.1]:56203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tW91I-0000C0-3m for submit@debbugs.gnu.org; Fri, 10 Jan 2025 02:01:24 -0500 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]:57744) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tW91F-0000Bk-Ci for 72249@debbugs.gnu.org; Fri, 10 Jan 2025 02:01:22 -0500 Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-844dfe4b136so43867839f.3 for <72249@debbugs.gnu.org>; Thu, 09 Jan 2025 23:01:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hallsby.com; s=google; t=1736492474; x=1737097274; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Z0EJee9vFjm9IXj8noabH1VxgucUslavG+ol44X00ZY=; b=VIcxdsHRRV9sIyb97R5aMFp4D9LWxsFbynIr4zGFUV4LUYcFjCXxMeqzlL0gajac4o RpN7kXVlR0abdkvBLL08SHPKzOUheGmuqj9eOzdv8uyqF5ypc67ufnXJJeHHuN9gNM98 rym4o8RSG/XQc9yRwRdhFiRZ0rk5z5nSWJJZMTolymAHr//Q8LxsHpCR7N/hBJUq+G1X 1nkfuN0GSRmxSBSeNoTonE/EfOtQILZbkjeLxeUIMQ3BuYZl1RdzOBKJay4ISUKlkw5w PT8NuNG/9NXTUN1iYymn64Ks70r3a9zMXGmUIdmJv0aK/Ja/Fp/96dUVk3cHBS+3DUXP GKpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736492474; x=1737097274; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Z0EJee9vFjm9IXj8noabH1VxgucUslavG+ol44X00ZY=; b=J+xXNtvdzSmXE/O2UU+Rewj3cVy/1VKbTNUFVNSalwMujxquxbHvHv2j+1LmS6dF2q f+tOkH6jg4FZe5T+tuONRUqXK9z0XDWIoRXbh60jMnRtc02mEs7pkpL+pH0Y5cbmYmG3 ui9IIp/NGjK6vAunBZc5x39WO70pyhk8aJxfujYrd+LUWfU7RsDLi8tmM3wqbGl0KCAu xb5oK+lcDxDINzLgVESWzykQQX7QwFNK5Ib27i1vYUYHeuFwSYkYmei2t/odrF9kdjsi xXYWESbg6SK94Q4jmEDbS4R0ZVDJKQIFjAjVqaIoOUYpEdvVRHHdK05Q0XxHm/Ul9SCh +ErA== X-Gm-Message-State: AOJu0YyA0ocmZe4x/vwMSm/BjkpF8Hio+SlnjJGLQJoFo6anZ+f6Vngo a9VfbKEBY9SJEqMTZQfvSkN9G2Tqxb8vhQ1Ywbjxe7MkWzZzm5qICkTFfYdZJhKWkwFsEzSXhNs = X-Gm-Gg: ASbGncthZ5QZ/9UF5ug1vc6B/lIZbO+q4G79UyoR2Kuem9f/ZM9PZKpNzkPqxevll0l Js54jjUZoG8hAC/9NLuUj42ckZcTxkypY02HUqnVbyrTmMirPOzR11n9OSKynUajZP7q/BfIbes Rc0AvY6y5GMBKvKKtlFUSvIW1CTFGtTR+NjWUwbytZAydj6+4hAYk4Isx2K+ZiOuC8vegNjihpd yUFyFsuNE0ME5Ye4F99gDM5GEH6eGZNWrOup/g5sMi1oDqoDfoayhMtOicDwA== X-Google-Smtp-Source: AGHT+IEo/ksnhlcoB5dKJ11u2knNlsw28Z7QQIK5aNq3/m9f7yRwlLJHgjgVf1pN+C6FxLvdzzyjLg== X-Received: by 2002:a05:6602:36cf:b0:843:e9c1:930b with SMTP id ca18e2360f4ac-84ce0194e69mr919091939f.14.1736492474359; Thu, 09 Jan 2025 23:01:14 -0800 (PST) Received: from Karl-Desktop.raven ([207.237.222.72]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4ea1b5f83cdsm743437173.15.2025.01.09.23.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 23:01:12 -0800 (PST) Date: Fri, 10 Jan 2025 01:00:59 -0600 Message-ID: <73106db7b8187d4b6bcc5d0c421ea3314ed7a498.1736491649.git.karl@hallsby.com> X-Mailer: git-send-email 2.46.0 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: BFFEF7AF4F X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: 1.04 X-Spam-Score: 1.04 X-TUID: 3Vdeb1LMUhAz * 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 | 71 +++++++++++++++++++++++++++++ gnu/services/virtualization.scm | 81 ++++++++++++++++++++++++++++++++- 2 files changed, 151 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index f7b7569887..afb886128b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -37328,6 +37328,77 @@ 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. + +@url{https://github.com/xenserver/xe-guest-utilities, xe-guest-utilities} collects information about the running virtualized guest. This includes: +@itemize +@item +static information +@itemize +@item +The operating system running +@item +The Linux kernel version +@end itemize + +@item +dynamic information +@itemize +@item +Network interfaces (devices) being added/removed +@item +Network connections being unplugged/plugged-in +@item +CPUs being added or removed +@item +The guest migrating, being paused/resumed, etc. +@end itemize + +@item +ephemeral information +@itemize +@item +The amount of memory currently in-use and free +@item +The amount of disk-space used +@end itemize +@end itemize + +@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"}) +Name of the file holding the PID of @code{xe-deamon}. + +@item @code{log-file} (default: @code{"/var/log/xe-guest-utilities.log"}) +Name of the @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. base-commit: 4eaeff997907bc1b67884a6dc087756a50f175e2 prerequisite-patch-id: daabcb5995f03ed867a27648e973e1c2203f2bc9 -- 2.46.0