]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Generate stable machine-id and DHCP client ID on POWER KVM.
authorDimitri John Ledkov <xnox@ubuntu.com>
Mon, 15 Apr 2019 14:07:52 +0000 (15:07 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 31 Aug 2019 08:57:16 +0000 (10:57 +0200)
man/machine-id.xml
src/core/machine-id-setup.c
src/hostname/hostnamed.c

index f4d94e880097b751ac36f63e1c2751c6f19a6eb9..ebee065a614f901e1000a5ab723be5c1c8ad43db 100644 (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>
index 9d3096e3ac98391bbf3208f3819dbea825175785..284b77c1fcce9d11b4ca0bbb03d13a4c156f96de 100644 (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;
+                        }
                 }
         }
 
index 75cba5827ce0db38df76ce9be4018f9a5d93ea3d..9e4f4fb59e71be38280f98964e9872d43f5c015f 100644 (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");