diff options
author | Dimitri John Ledkov <xnox@ubuntu.com> | 2019-04-15 15:07:52 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-08-31 10:57:16 +0200 |
commit | 8fa0de653b634f1b7377857c2dd99cfc84a77527 (patch) | |
tree | 4ebfc556f893aac48aa0ac4c82c3da795b0c7e24 | |
parent | 6b4f7fb08c15d7d400d0b051f4445f6f51128bec (diff) | |
download | systemd-8fa0de653b634f1b7377857c2dd99cfc84a77527.tar.gz |
Generate stable machine-id and DHCP client ID on POWER KVM.
-rw-r--r-- | man/machine-id.xml | 4 | ||||
-rw-r--r-- | src/core/machine-id-setup.c | 5 | ||||
-rw-r--r-- | src/hostname/hostnamed.c | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/man/machine-id.xml b/man/machine-id.xml index f4d94e8800..ebee065a61 100644 --- a/man/machine-id.xml +++ b/man/machine-id.xml @@ -99,8 +99,8 @@ be used. If this file is empty or missing, <filename>systemd</filename> will attempt to use the D-Bus machine ID from <filename>/var/lib/dbus/machine-id</filename>, the value of the kernel command line option <varname>container_uuid</varname>, the KVM DMI - <filename>product_uuid</filename> (on KVM systems), and finally a randomly generated - UUID.</para> + <filename>product_uuid</filename> or the devicetree <filename>vm,uuid</filename> + (on KVM systems), and finally a randomly generated UUID.</para> <para>After the machine ID is established, <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c index 9d3096e3ac..284b77c1fc 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 75cba5827c..9e4f4fb59e 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"); |