From: Dimitri John Ledkov Date: Mon, 15 Apr 2019 14:07:52 +0000 (+0100) Subject: Generate stable machine-id and DHCP client ID on POWER KVM. X-Git-Tag: v243~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8fa0de653b634f1b7377857c2dd99cfc84a77527;p=thirdparty%2Fsystemd.git Generate stable machine-id and DHCP client ID on POWER KVM. --- diff --git a/man/machine-id.xml b/man/machine-id.xml index f4d94e88009..ebee065a614 100644 --- a/man/machine-id.xml +++ b/man/machine-id.xml @@ -99,8 +99,8 @@ be used. If this file is empty or missing, systemd will attempt to use the D-Bus machine ID from /var/lib/dbus/machine-id, the value of the kernel command line option container_uuid, the KVM DMI - product_uuid (on KVM systems), and finally a randomly generated - UUID. + product_uuid or the devicetree vm,uuid + (on KVM systems), and finally a randomly generated UUID. After the machine ID is established, systemd1 diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c index 9d3096e3ac9..284b77c1fcc 100644 --- a/src/core/machine-id-setup.c +++ b/src/core/machine-id-setup.c @@ -68,6 +68,11 @@ static int generate_machine_id(const char *root, sd_id128_t *ret) { log_info("Initializing machine ID from KVM UUID."); return 0; } + /* on POWER, it's exported here instead */ + if (id128_read("/sys/firmware/devicetree/base/vm,uuid", ID128_UUID, ret) >= 0) { + log_info("Initializing machine ID from KVM UUID."); + return 0; + } } } diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index 75cba5827ce..9e4f4fb59e7 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -116,6 +116,8 @@ static int context_read_data(Context *c) { return r; r = id128_read("/sys/class/dmi/id/product_uuid", ID128_UUID, &c->uuid); + if (r == -ENOENT) + r = id128_read("/sys/firmware/devicetree/base/vm,uuid", ID128_UUID, &c->uuid); if (r < 0) log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_WARNING, r, "Failed to read product UUID, ignoring: %m");