From 38d632aad551cbf4dc44f759a0cf507ecacda238 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C3=ABl=20Kooi?=
<48814281+RA-Kooi@users.noreply.github.com>
Date: Mon, 22 Jan 2024 17:04:07 +0100
Subject: [PATCH 0202/1160] id128-util: Attempt to read UUID from
/sys/hypervisor/uuid
When using the Xen hypervisor the virtual machine UUID is exposed here.
This is useful when one needs stable IPv4 address assignment, e.g. for a
set of RAM nodes that are built from a template.
(cherry picked from commit d2f2c20a6dc0f5c6fbab7d7ca8dc8f636a72abdb)
src/libsystemd/sd-id128/id128-util.c | 2 ++
1 file changed, 2 insertions(+)
@@ -234,6 +234,8 @@ int id128_get_product(sd_id128_t *ret) {
r = id128_read("/sys/class/dmi/id/product_uuid", ID128_FORMAT_UUID, &uuid);
if (r == -ENOENT)
r = id128_read("/proc/device-tree/vm,uuid", ID128_FORMAT_UUID, &uuid);
+ if (r == -ENOENT)
+ r = id128_read("/sys/hypervisor/uuid", ID128_FORMAT_UUID, &uuid);
if (r < 0)
return r;
--
2.33.0