1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-20 18:04:03 +03:00

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.
This commit is contained in:
Rafaël Kooi 2024-01-22 17:04:07 +01:00
parent 9603fd29f8
commit d2f2c20a6d

View File

@ -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;