From d2f2c20a6dc0f5c6fbab7d7ca8dc8f636a72abdb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C3=ABl=20Kooi?= <48814281+RA-Kooi@users.noreply.github.com> Date: Mon, 22 Jan 2024 17:04:07 +0100 Subject: [PATCH] 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. --- src/libsystemd/sd-id128/id128-util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libsystemd/sd-id128/id128-util.c b/src/libsystemd/sd-id128/id128-util.c index 5808cea7576..a73bc1fa540 100644 --- a/src/libsystemd/sd-id128/id128-util.c +++ b/src/libsystemd/sd-id128/id128-util.c @@ -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.47.3