Generate stable machine-id and DHCP client ID on POWER KVM.

This commit is contained in:
Dimitri John Ledkov 2019-04-15 15:07:52 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 6b4f7fb08c
commit 8fa0de653b
3 changed files with 9 additions and 2 deletions

View File

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

View File

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

View File

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