diff options
| author | Douglas Deslauriers <Douglas.Deslauriers@vector.com> | 2025-04-29 11:30:02 -0400 |
|---|---|---|
| committer | Sharlatan Hellseher <sharlatanus@gmail.com> | 2026-08-14 11:07:36 +0100 |
| commit | 910e426076ea078bd8a2bed658999250e37d46c3 (patch) | |
| tree | a78ffcdefd75459292f778737ca26266867da8e4 /gnu | |
| parent | 637a34743d87b25d39f4a6c685b52b49b703e59a (diff) | |
services: vmware-vmtoolsd: Add vmware-vmtoolsd service.
Reasoning on running these executables outside a VMWare hypervisor is
difficult, which mean we can't implement service tests in current state
of the art in upstream QEMU.
Essentially the first thing any `open-vm-tools' executable checks is
whether it is executing in a VMWare hypervisor via
`CPUID_VMWARE_HYPERVISOR_VENDOR_STRING' [1]. This would fail for any
machine not running inside VMWare.
Marionette evaluations in Guix use QEMU to run the virtual machines that
some tests run on. QEMU emulates and allow configuration of some CPUID
flags and vendor strings. It does not emulate the hypervisor flag, or
allow configuration of the hypervisor vendor flag, which would be
required for this program to run and output anything observable, other
than a non-zero exit code.
In the case someone added upstream QEMU support for custom CPUID
hypervisor flags and vendor strings, these executables would initialize
a log file, but could not test anything meaningful without a hypercall
interface. QEMU sort-of emulates such an interface when it is told to
act like the Xen hypervisor, but doesn't seem to support the required
`vmcall', `vmmcall', or `inl' x86 assembly instruction communication
mechanism between the host and guest.
The Linux KVM supports a limited set of hypercalls [2], but certainly
not the ones required for these executables, the same applies for
Hurd. Since the KVM project already has a functional serial interface
between the guest and host [3], it is a low possibility upstream would
want to greatly expand the `vmcall' hypercall support in any case.
An alternative path would be to add the `USE_VALGRIND' define when
compiling the `vmware-open-vm-tools' package, which skips the hypervisor
CPUID flag checking, but still would require proper hypercall support to
test anything useful. Additionally, this would require another package,
or perhaps a "testing" output of the `vmware-open-vm-tools' pacakge,
which would be a nearly entire duplicate of the executables and would be
used exclusively for whichever test is written.
1. <https://github.com/vmware/open-vm-tools/blob/stable-13.1.x/open-vm-tools/lib/vmCheck/vmcheck.c#L335>
2. <https://docs.kernel.org/virt/kvm/x86/hypercalls.html>
3. <https://linux-kvm.org/page/VMchannel_Requirements>
* gnu/services/virtualization.scm
(vmware-vmtoolsd-shepherd-service): new procedures.
(vmware-vmtoolsd-service-type): new service type
(vmware-vmtoolsd-configuration): new struct.
update copyright commentary.
* doc/guix.texi (Virtualization Services): document it.
Merges: guix/guix!5098
Modified-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/services/virtualization.scm | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm index 502894eb66b..8e8a5b51c7a 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | ;;; Copyright © 2024 Raven Hallsby <karl@hallsby.com> | 9 | ;;; Copyright © 2024 Raven Hallsby <karl@hallsby.com> |
| 10 | ;;; Copyright © 2025 Maxim Cournoyer <maxim@guixotic.coop> | 10 | ;;; Copyright © 2025 Maxim Cournoyer <maxim@guixotic.coop> |
| 11 | ;;; Copyright © 2025 Nigko Yerden <nigko.yerden@gmail.com> | 11 | ;;; Copyright © 2025 Nigko Yerden <nigko.yerden@gmail.com> |
| 12 | ;;; Copyright © 2025 Douglas Deslauriers <Douglas.Deslauriers@vector.com> | ||
| 12 | ;;; Copyright © 2026 Giacomo Leidi <therewasa@fishinthecalculator.me> | 13 | ;;; Copyright © 2026 Giacomo Leidi <therewasa@fishinthecalculator.me> |
| 13 | ;;; | 14 | ;;; |
| 14 | ;;; This file is part of GNU Guix. | 15 | ;;; This file is part of GNU Guix. |
| @@ -168,7 +169,14 @@ | |||
| 168 | xe-guest-utilities-configuration | 169 | xe-guest-utilities-configuration |
| 169 | xe-guest-utilities-service-type | 170 | xe-guest-utilities-service-type |
| 170 | xen-guest-agent-configuration | 171 | xen-guest-agent-configuration |
| 171 | xen-guest-agent-service-type)) | 172 | xen-guest-agent-service-type |
| 173 | |||
| 174 | vmware-vmtoolsd-configuration | ||
| 175 | vmware-vmtoolsd-configuration? | ||
| 176 | vmware-vmtoolsd-configuration-pid-file | ||
| 177 | vmware-vmtoolsd-configuration-requires-xorg? | ||
| 178 | vmware-vmtoolsd-configuration-vmware-open-vm-tools | ||
| 179 | vmware-vmtoolsd-service-type)) | ||
| 172 | 180 | ||
| 173 | (define (uglify-field-name field-name) | 181 | (define (uglify-field-name field-name) |
| 174 | (let ((str (symbol->string field-name))) | 182 | (let ((str (symbol->string field-name))) |
| @@ -2050,3 +2058,45 @@ machines in /etc/guix/machines.scm." | |||
| 2050 | (description | 2058 | (description |
| 2051 | "Provide a virtual machine (VM) running GNU/Hurd, also known as a | 2059 | "Provide a virtual machine (VM) running GNU/Hurd, also known as a |
| 2052 | @dfn{childhurd}."))) | 2060 | @dfn{childhurd}."))) |
| 2061 | |||
| 2062 | (define-record-type* <vmware-vmtoolsd-configuration> | ||
| 2063 | vmware-vmtoolsd-configuration | ||
| 2064 | make-vmware-vmtoolsd-configuration | ||
| 2065 | vmware-vmtoolsd-configuration? | ||
| 2066 | ;; string | ||
| 2067 | (pid-file vmware-vmtoolsd-configuration-pid-file | ||
| 2068 | (default "/var/run/vmware-vmtoolsd.pid")) | ||
| 2069 | ;; Boolean | ||
| 2070 | (requires-xorg? vmware-vmtoolsd-configuration-requires-xorg? | ||
| 2071 | (default #f)) | ||
| 2072 | ;; file-like object | ||
| 2073 | (vmware-open-vm-tools vmware-vmtoolsd-configuration-vmware-open-vm-tools | ||
| 2074 | (default vmware-open-vm-tools))) | ||
| 2075 | |||
| 2076 | (define (vmware-vmtoolsd-shepherd-service config) | ||
| 2077 | "Return a <shepherd-service> for VMWare's Open VM Tools vmtoolsd with CONFIG." | ||
| 2078 | (let ((package | ||
| 2079 | (vmware-vmtoolsd-configuration-vmware-open-vm-tools config)) | ||
| 2080 | (requires-xorg? (vmware-vmtoolsd-configuration-requires-xorg? config))) | ||
| 2081 | (list (shepherd-service (documentation | ||
| 2082 | "Run the VMWare's Open VM Tools daemon (vmtoolsd)") | ||
| 2083 | (provision '(vmtoolsd)) | ||
| 2084 | (requirement (if requires-xorg? | ||
| 2085 | '(xorg-server) | ||
| 2086 | '())) | ||
| 2087 | (start #~(make-forkexec-constructor (list #$(file-append | ||
| 2088 | package | ||
| 2089 | "/bin/vmtoolsd")))) | ||
| 2090 | (stop #~(make-kill-destructor)))))) | ||
| 2091 | |||
| 2092 | (define vmware-vmtoolsd-service-type | ||
| 2093 | (service-type (name 'vmtoolsd) | ||
| 2094 | (description | ||
| 2095 | "Run the VMWare Open VM Tools daemon, @command{vmtoolsd}.") | ||
| 2096 | (extensions (list (service-extension | ||
| 2097 | shepherd-root-service-type | ||
| 2098 | vmware-vmtoolsd-shepherd-service) | ||
| 2099 | (service-extension profile-service-type | ||
| 2100 | (compose list | ||
| 2101 | vmware-vmtoolsd-configuration-vmware-open-vm-tools)))) | ||
| 2102 | (default-value (vmware-vmtoolsd-configuration)))) | ||
