From: Rafaƫl Kooi <48814281+RA-Kooi@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:04:07 +0000 (+0100) Subject: id128-util: Attempt to read UUID from /sys/hypervisor/uuid X-Git-Tag: v256-rc1~1056^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2f2c20a6dc0f5c6fbab7d7ca8dc8f636a72abdb;p=thirdparty%2Fsystemd.git 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. --- 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;