From patchwork Wed Jan 8 20:10:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Raven Hallsby X-Patchwork-Id: 36773 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D9DA627BBE9; Wed, 8 Jan 2025 20:11:53 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5903E27BBEA for ; Wed, 8 Jan 2025 20:11:52 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVcOf-00041V-2h; 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 1tVcON-0003nA-A3 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 1tVcOM-0003Kf-Sm for guix-patches@gnu.org; Wed, 08 Jan 2025 15:11: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=somyza2vcM3JVbXzqiKgg/8tRBGz7YaOKrulL5YOpaY=; b=lnGvUUde0VHXXoqombJkn2+zZVj7Lqpb77sBWP/VlXwbXvvxkgH5Y0cRHX1toMtVL8lVNJ47oUFHGMYwPt3WnmVST7SUdEBYzgSn5FmZG0W6DwQ69Rl8vzuU0qcAqK3TROn9AFRJ00b1nWCb1ehDzttKYPwckE+VltlXy3s5VAcj+pT/8RPi6fA+ToDbe4x8IgY3aDZsrvaTKHZ9xUIlCIxw37D0ky/eK0j5c/NhLgthG23VIkBxZgcV73qEJZujfizOlzDO7AE8IzDQ3IUa/HIcXOSikRZuZQqOxom+Q0Q8jIFICf58lTozgUO3Oqmrr5FtTJLNoo1Oz6EEUE3PKg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tVcOM-0000b1-DW; Wed, 08 Jan 2025 15:11:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#72249] [PATCH 1/2] gnu: Add xe-guest-utilities. References: In-Reply-To: Resent-From: Karl Hallsby Original-Sender: "Debbugs-submit" Resent-CC: sharlatanus@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 , Sharlatan Hellseher X-Debbugs-Original-Xcc: Sharlatan Hellseher Received: via spool by 72249-submit@debbugs.gnu.org id=B72249.17363670432251 (code B ref 72249); Wed, 08 Jan 2025 20:11:02 +0000 Received: (at 72249) by debbugs.gnu.org; 8 Jan 2025 20:10:43 +0000 Received: from localhost ([127.0.0.1]:49092 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tVcO3-0000aF-0o for submit@debbugs.gnu.org; Wed, 08 Jan 2025 15:10:43 -0500 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:47188) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tVcNy-0000Zt-Sk for 72249@debbugs.gnu.org; Wed, 08 Jan 2025 15:10:41 -0500 Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-84cdb6fba9bso7426339f.2 for <72249@debbugs.gnu.org>; Wed, 08 Jan 2025 12:10:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hallsby.com; s=google; t=1736367032; x=1736971832; 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=somyza2vcM3JVbXzqiKgg/8tRBGz7YaOKrulL5YOpaY=; b=Sb26c20of/AURoGK8rGljN9PwnZTiHUbPpODt1IIk9sriKhE+IO57CkQXxpX2vWTpf HPKt6hzb0iC6CV2NO3F81/zvYpUSf7jMrUZ3u0F+RgghLc240Z1tQSAff8GiJSo6g3wO k1AwsjzxkJyoILEAF1IWnC60QTrq5Y8MBq+tyKnNBoCEVJhGzXbrqFMoZ6WKhjORfLa/ 2oVx3qo0kctEWRmO13h2x4lFxLxdULREMODJLCPuqFmf5BTBgzKRftIKLA5v2604eUzJ N7LFC+rOcnvUl16By0YBrkLE3L1obnBaEUmp2ITUXFwWOxaeozxn2DCl5vT/F5I0L3o4 3c6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736367032; x=1736971832; 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=somyza2vcM3JVbXzqiKgg/8tRBGz7YaOKrulL5YOpaY=; b=QBXCvR3UHOW3np8aJpa2fGZl2ilHngW43pWUWnwcIlO/65nambThX8zyoFWODWxgOy wxVZsUgIp0UGG73BXpx36uxz/1WRjpWPu6ToOOJKwy2yMIwjuGXWPmLQ4QdiFWPec4if IQptCtpMTz8dpO9I4yHBYdZzz+vcxpRw5IWvqx0iPimy0rFVF4m0+ElivI+EX+4SaWt8 1LPQLQiXWcjlkd/yAPE7EbVAsKNbJtAbWVwyi53XFe6VH1wQlpoWOIy3hCKxghyWnzmZ u9kpaXl6XmLj3diR3EXQnZh4IWciJ4YhdmbbrnC50DvXiWjdhqh+Vv2zPCF/vTiqPRYg OJGQ== X-Gm-Message-State: AOJu0YxvNqDLzOcmnDJr+aAWdJyDGEHzRm+W16/lo7pgB2v/1ySnY3kr 4bIUATPKmYbFEVZgTafYgrREQ3TrQvM1h84d+rcJjc+P0tUq2Xmdzsug7r3dRlqYIswWwu4C36c = X-Gm-Gg: ASbGncuUFYWgWVQoKT8owGTcQOlyI7pEJAIet9wMvk5d9snGwGjvKL8qqJwQ7yNwQV2 oQ7m07JZ358fY8XMaWgkL+la3dkahysOUz6wP/uvbC6sweA8ymJ1M3caMm4b1w3x0CfKipqgS0b /1ojJ3fiUQcUIRB/AKcHWNyyWeU43Nz2p1JEsA/xVcZjq+3uDJxABYrTuwK37Pjoz1AOcWmqf5o iFnNjZHBijdpflZAsoTUdIVsrzNZBMNnwvmnvusOzOSW6NUPFxeEs0oP+1MAQ== X-Google-Smtp-Source: AGHT+IHvmpSFqx64aHr0ZEYcZ2eK15e0bRCO5jVBNQyaNTq3AU/7VcfOZ/Z99A6zDeDg81MIum07KA== X-Received: by 2002:a05:6e02:87:b0:3a6:c98d:86bc with SMTP id e9e14a558f8ab-3ce3a86a258mr39807325ab.1.1736367032301; Wed, 08 Jan 2025 12:10:32 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 12:10:31 -0800 (PST) Date: Wed, 8 Jan 2025 14:10:25 -0600 Message-ID: <6920fcb2b7edd619b323c7f70d076a7a73ab0463.1736366732.git.karl@hallsby.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 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 X-Patchwork-Original-From: Karl Hallsby via Guix-patches via From: Raven Hallsby Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/virtualization.scm (xe-guest-utilities): Init at 8.4.0 Change-Id: I4daf19dc1964be00554e1c598ef88897081f5d52 --- gnu/packages/virtualization.scm | 88 +++++++++++++++++++++++++++++++++ gnu/services/virtualization.scm | 1 + 2 files changed, 89 insertions(+) base-commit: 4eaeff997907bc1b67884a6dc087756a50f175e2 diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm index 9dff421341..3b162474af 100644 --- a/gnu/packages/virtualization.scm +++ b/gnu/packages/virtualization.scm @@ -104,6 +104,7 @@ (define-module (gnu packages virtualization) #:use-module (gnu packages gnome) #:use-module (gnu packages gnupg) #:use-module (gnu packages golang) + #:use-module (gnu packages golang-build) #:use-module (gnu packages gperf) #:use-module (gnu packages graphviz) #:use-module (gnu packages gtk) @@ -2772,6 +2773,93 @@ (define-public xen (license license:gpl2) (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux")))) +(define-public xe-guest-utilities + (package + (name "xe-guest-utilities") + (version "8.4.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/xenserver/xe-guest-utilities") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1yqspizhq3ii6cz2w75slaxy8838yyri9pmgc2q1radnm7w735if")))) + (build-system go-build-system) + (arguments + (list + #:import-path "github.com/xenserver/xe-guest-utilities" + #:install-source? #f + #:tests? #f ; There are no tests. + #:phases + #~(modify-phases %standard-phases + ;; Despite using go-build-system, this project does not use Go's build + ;; infrastructure to do anything, instead relying on a Makefile. + ;; NOTE: This target builds a tarball, but it is only filled with + ;; 2 binaries, 1 script, and a bunch of text files; it is tiny. + (add-after 'patch-source-shebangs 'fix-udev-rule + (lambda* (#:key inputs import-path #:allow-other-keys) + (substitute* (string-append "src/" import-path "/mk/xen-vcpu-hotplug.rules") + (("/bin/sh") (search-input-file inputs "/bin/sh"))))) + (replace 'build + (lambda* (#:key import-path #:allow-other-keys) + (let* ((version #$version) + (version-split (string-split version #\.)) + (major-version (list-ref version-split 0)) + (minor-version (list-ref version-split 1)) + (micro-version (list-ref version-split 2)) + (build-number "0")) + (with-directory-excursion (string-append "src/" import-path) + ;; Perform a buggy substitution. In Guix, the Go's guestmetric + ;; import will resolve to the source version, NOT the version + ;; the Makefile and sed substituted into build/. So we perform + ;; the correct substitution. + ;; This file list is what make & sed substitute, but we do it + ;; in-place too. + (substitute* (list "xe-daemon/xe-daemon.go" + "syslog/syslog.go" + "system/system.go" + "guestmetric/guestmetric.go" + "guestmetric/guestmetric_linux.go" + "xenstoreclient/xenstore.go" + "xenstore/xenstore.go") + (("@PRODUCT_MAJOR_VERSION@") major-version) + (("@PRODUCT_MINOR_VERSION@") minor-version) + (("@PRODUCT_MICRO_VERSION@") micro-version) + (("@NUMERIC_BUILD_NUMBER@") build-number)) + ;; Explicitly state version, removes git as native-input and + ;; removes using git commit hash as an ID. + ;; NOTE: The final step of the Makefile's build target is to "cd" + ;; to the final build directory. + (invoke "make" "build" + (string-append "RELEASE=" version) + (string-append "PRODUCT_MAJOR_VERSION=" major-version) + (string-append "PRODUCT_MINOR_VERSION=" minor-version) + (string-append "PRODUCT_MICRO_VERSION=" micro-version)))))) + ;; The default "install" actions produce package-manager-specific + ;; outputs, .deb, .rpm, and .tgz. We just copy the final build + ;; products out. + (replace 'install + (lambda* (#:key outputs import-path #:allow-other-keys) + (let* ((stage (string-append "src/" import-path "/build/stage")) + (out (assoc-ref outputs "out"))) + ;; Put udev rules in #$output/lib/udev/rules.d/ + (copy-recursively (string-append stage "/etc/udev") + (string-append out "/lib/udev")) + ;; Copy produced binaries and scripts + (copy-recursively (string-append stage "/usr") out))))))) + (native-inputs (list go-golang-org-x-sys)) + (inputs (list bash-minimal)) + (home-page "https://github.com/xenserver/xe-guest-utilities") + (synopsis "XenServer guest utilities for unix-like operating systems") + (description "The XenServer guest utilities enable a Xen-based hypervisor, +(Citrix XenServer, XCP-ng, etc.) to work with a Xen-enabled Unix-like guest VMs. +This allows the guest to share information about its state back to the host, +such IP address, memory usage, etc. and allows the host to inform the guest VM +about events that change the virtualized hardware, such as hotplugging.") + (license license:bsd-2))) + (define-public osinfo-db-tools (package (name "osinfo-db-tools") diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm index 53f79e367b..c32c47484c 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2022 Oleg Pykhalov ;;; Copyright © 2022 Leo Nikkilä ;;; Copyright © 2023 Efraim Flashner +;;; Copyright © 2024 Raven Hallsby ;;; ;;; This file is part of GNU Guix. ;;; From patchwork Wed Jan 8 20:10:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raven Hallsby X-Patchwork-Id: 36772 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4001C27BBEC; Wed, 8 Jan 2025 20:11:53 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 57F3C27BBE9 for ; Wed, 8 Jan 2025 20:11:52 +0000 (GMT) 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 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 X-Patchwork-Original-From: Karl Hallsby via Guix-patches via From: Raven Hallsby Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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.